Support » Themes and Templates » Displaying posts in a particular category as well as page content

  • I’m trying to create a page template that has posts from a particular category displayed at the top and the content for the individual pages that use the template at the bottom. When I add the code to get the posts:

    <?php query_posts("cat=5&order=ASC&posts_per_page=-1");
    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<li><a href="/what-we-are-doing/#<?php the_ID(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
    <?php endwhile; ?>
    <?php endif; ?>

    it doesn’t display the page content any more.

    What I need to know is how to requery and get the content for the current page after looping through the posts in category 5. The current page content is obviously dynamic because this is a page template, so I can’t hardcode something like:

    query_posts(’pagename=homepage’);

    unless I can somehow get the current page slug and then pass it to query_posts. I’m thinking that there’s a better way though, but I can’t figure it out. Any suggetstions?

  • The topic ‘Displaying posts in a particular category as well as page content’ is closed to new replies.