WordPress.org

Ready to get started?Download WordPress

Forums

Displaying posts in a particular category as well as page content (1 post)

  1. lborloz
    Member
    Posted 6 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic