Forums

[resolved] Can't stop multiple posts showing on single page (3 posts)

  1. desmondo
    Member
    Posted 1 year ago #

    Hi all

    This is a weird one, although maybe someone will make sense of it!

    I want to show a list of all other posts on my single post page, in the navigation. I want the list to show only posts of the category I'm viewing, so I've done it using a query:

    <?php query_posts('cat=4'); ?>

    The problem is, if I use that line of code anywhere before I specify

    <?php the_content(''); ?>

    in my code, the page prints out every post in category 4. If I use that post query after the_content, it works fine. The trouble is, my menu is left aligned, so it needs to come first in the code.

    Is there any way of getting a category specific post nav to work on a single page?

    Thanks

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    use wp_reset_query(); after the code in the sidebar.

    http://codex.wordpress.org/Function_Reference/wp_reset_query

  3. desmondo
    Member
    Posted 1 year ago #

    Works a treat, thanks for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic