WordPress.org

Support

Support » How-To and Troubleshooting » post_per_page for the index page…

post_per_page for the index page…

  • This may seem like a silly question, but how do I get the post_per_page working?
    In my admin screen, under Options, I have post_per_page set to 5. Next to that option it states “How many posts/days to show on the index page.”
    However, I currently have 6 posts showing up on my index page. (It’s a new blog, so I only have 6 posts so far.)
    What’s the trick to getting the “5” working that I set in the Options page?
    Thanks,
    Tony

Viewing 2 replies - 1 through 2 (of 2 total)
  • You should not have to mess with anything to get the posts per page to work. You could type in something like
    echo “posts_per_page = “.$posts_per_page;
    somewhere inside your blog.header.php and it will tell you the value it should be using. It is stored in the database and retrieved by blog.header.php

    Ok, posts_per_page is now working properly, but at the expense of filtering out a category. (I could have sworn I posted this already, but perhaps my lack of sleep is causing me to hallucinate, or I posted it in some random topic by mistake…)
    Anyway, when I remove the following:
    if (empty($cat))
    $cat = -14;
    from near the top of my template (just after $blog = 1;), posts_per_page works like a champ…but I’ll now get unwanted posts every time I add something to the About page (category 14.)
    Does anyone know why setting $cat to -14 (thus filtering out that category) would cause posts_per_page to stop working? Doesn’t make sense to me…
    Thanks,
    Tony

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘post_per_page for the index page…’ is closed to new replies.
Skip to toolbar