• greasypigstudios

    (@greasypigstudios)


    I have a category archive page that is paginated to handle any number of posts.

    All the pages show 20 posts, except for the first page of post links, which will only show the first 10, as the rest of the space will be reserved for an introduction to that category.

    Any tips on how to achieve the unique pagination and the different format for the first page? I would like this to be as automated as possible so that the next archive pages will show 11-30, 31-50, and so on, and the next/previous links are also just as they should be.

Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi

    (@esmi)

    https://codex.www.ads-software.com/Template_Tags/query_posts

    I think if you check your category template file, you’ll find that it uses the same custom query approach (query_posts).

    Thread Starter greasypigstudios

    (@greasypigstudios)

    I have a little but unadvanced knowledge of query_posts, but using it I’m a little confused as to how to tell it to show 10 posts on page 1 of the archives and 20 posts on each subsequent page, along with a different display format for the first page.

    Michael

    (@alchymyth)

    https://codex.www.ads-software.com/Conditional_Tags#A_Paged_Page

    for instance, instead of using just the query and the loop, you could use something like this:

    <?php
    if(is_paged()) :
    $posts_on_page = 20 ;
    // run the query with 20 articles
    // do loop for second and other paged archives
    // etc
    else :
    $posts_on_page = 10;
    // run the query with 10 articles
    // do loop for first page archives
    // etc
    endif;
    ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Different template for first page of category pagination’ is closed to new replies.