Forums

[resolved] query_posts() problems on a page (3 posts)

  1. r4fay
    Member
    Posted 11 months ago #

    Hello. I'm new here as well as new to WordPress. I'm having a bit of a problem here, I'll try to explain.

    I'm using WordPress as a CMS. I want to display blog posts on a "page" rather than the default. So, I've my page created titled "blog" which I'm using as a placeholder for the blog posts, as stated in the Codex. Now, in the blog.php file (in-charge of displaying posts) I'm using query_posts() post function.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    I've posted 8 gibberish posts at the moment. The problem is, when I click the the "older entries" (<?php next_posts_link ?>), it still displays 5 posts rather than displaying the remaining 3 of the them.

    So, any suggestions on how to fix this issue? Any help would be deeply appreciated.

    Thnkas

  2. alchymyth
    The Sweeper
    Posted 11 months ago #

    the custom query probably needs to use the pagination parameter;
    try:

    <?php query_posts("posts_per_page=5&paged=".get_query_var('paged')); ?>

    http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters

  3. r4fay
    Member
    Posted 11 months ago #

    Never mind guys. I found the solution by searching a little more on the web. If any of you is wondering how I did this, here's the method. How to create a separate page for blog posts in wordpress

Reply

You must log in to post.

About this Topic