WordPress.org

Forums

Static front page pagination documentation amy be wrong? (3 posts)

  1. chrishoward
    Member
    Posted 9 months ago #

    Reading the Pagination page in the Codex, I couldn't get the instructions for making pagination work on a static home page until I added:
    global $paged;

    before everything. I couldn't see any mention of this requirement on that page (assuming it is a requirement).

  2. kjodle
    Member
    Posted 9 months ago #

    I couldn't get the instructions for making pagination work on a static home page

    A static home page is, by definition, a single page and doesn't require pagination. It is "page 1 of 1 pages".

    So where are you trying to get pagination to appear?

  3. chrishoward
    Member
    Posted 9 months ago #

    On "static front page.

    All pages are static "page 1 of 1 pages" but pagination works on them. It's only the "static front page" where you need special code to make pagination work.

    Sometimes, some people do want a front page that is a blend of static content and paged posts.

    To that end, that instruction page on Pagination tells you how it *should* work. To quote the whole section:

    static front page

    If the pagination is broken on a static front page you have to add the "paged" parameter this way:

    <?php
    if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
    elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
    else { $paged = 1; }
    
    query_posts('posts_per_page=3&paged=' . $paged);
    ?>

    But without the global $paged; it doesn't work for me.

Reply

You must log in to post.

About this Topic