• Resolved hsatterwhite

    (@hsatterwhite)


    I was wondering if there is a way to make an exception to the loop that will let you apply custom styles to any post listing pages that come after the first/main post listing page?

    For example the initial listing page for a category will have one look and than all of the pages for older/previous entries will have an alternative style/look to them.

    Thanks 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter hsatterwhite

    (@hsatterwhite)

    Ok, so I could run a conditional to check if the post listings are paged, but how would I pragmatically distinguish the first listing page from the ones that follow, so that the initial page has a different layout and the following pages are uniform?

    Thanks for the link. I’m going to read more in to that function itself.

    Firstly you use something like this to setup the paged variable..

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 0 ;
    ?>

    Once you have that, you know the first page is 0…
    So..

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 0 ;
    if($paged == 0) {
    // It's the first page do something
    }
    elseif($paged == 1) {
    // It's the next page
    }
    else {
    // It's any pages other then the first or second
    }
    ?>

    You don’t necessarily need to do lots of IF/ELSE, you could use a switch….

    Thread Starter hsatterwhite

    (@hsatterwhite)

    Spot on! Simple and easy. Yea a switch might be faster depending on how expanded this gets.

    Thanks so much for the help t310s and esmi 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Customizing post listing pages that follow the initial post listing page.’ is closed to new replies.