[resolved] need loop displaying single post from one category (6 posts)

  1. bodhidude
    Posted 5 years ago #

    Hey all
    I'm designing a page that will display a single post from one category. These posts contain images and I want the loop on this page to display just one post but then have people be able to page through the rest of the posts with the post nav buttons. I am using:
    <?php query_posts('cat=14&showposts=1'); ?>
    and this works but the navigation buttons don't work, it just keeps displaying the same post. What is the best way to do this?
    This is the page in question:http://josephinesdream.com/?page_id=34

  2. jocken
    Posted 5 years ago #

    You have to reset the query after the loop, like this.



    Need a little more of the code to realy see the problem. But I hope that works.

  3. bodhidude
    Posted 5 years ago #

    Hey thank for your response.....unfortunately its still not working. I put wp_reset_query after endwhile; and I lost my post nav buttons, I tried putting it after the post nav buttons and I still just get one post, this is the loop for this page:

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

    Thanks for your help, this has been a real problem.

  4. bodhidude
    Posted 5 years ago #

    oooops ok here is the code for the loop....
    any help would be very much appreciated.

  5. bodhidude
    Posted 5 years ago #

    can anyone help with this?

  6. bodhidude
    Posted 5 years ago #

    resolved it with this:

    <?php if (have_posts()) : ?>
    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("category_name=somecat&paged=$paged"); ?>
    <?php while (have_posts()) : the_post(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic