WordPress.org

Ready to get started?Download WordPress

Forums

Pagination not working (3 posts)

  1. jennifer2010
    Member
    Posted 1 year ago #

    I have my Homepage set to a certain page, and my blog page to something else.

    On my homepage, I'm trying to display only posts from a certain category. Here is the code I'm using for that:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
    <?php query_posts("cat=1&showposts=2&paged=$paged"); ?>

    What's not working is pagination. Every page shows the same posts that are on the homepage, and even though I'm on mysite.com/page/2/ - the navigation link displays as if I'm on page 1.

    I have spent a good 3 hours trying different code from Googling and nothing works. I am going insane.

    Please help.

  2. jennifer2010
    Member
    Posted 1 year ago #

  3. Fire Truck
    Member
    Posted 1 year ago #

    If your home page is set to 'Your latest posts`, use
    get_query_var('paged')

    If your home page is set to 'A static page', use
    get_query_var('page')

    ;)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.