Support » Fixing WordPress » query_posts, display 1 page and posts from select category?

  • On one of my pages I would like to display the contents of the page followed by all posts made in a specific category..


    -Page Contents
    -Category 1
    –etc etc

    I can use in the pages template query_posts(‘cat=X’); to display all the posts in the selected category but as soon as I do the template doesn’t display the page contents.

    So i was thinking maybe you could combine the query_posts with a page? query_posts('page_id=160&cat=X')

    But sadly it doesn’t work, does anyone have advice on how to do this?

Viewing 1 replies (of 1 total)
  • I do something similar however, I cant figure out how to put in the navigation when I have more than 15 posts (i.e. to see the next 15 older posts) Other than that this works:

    <?php get_header(); ?>
    	<div id="content" class="narrowcolumn">
    	<div id="entry">
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    		<div class="content_top">
    			<h2><?php the_title(); ?></h2>
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    			<div class="search">
    			Search: <?php include (TEMPLATEPATH . '/searchform.php'); ?>
     $lastposts = get_posts('numberposts=15&category=17&orderby=ID&order=ASC');
     foreach($lastposts as $post) :
    <div id="subentry">
    <?php global $more;
    $more = 0; ?>
     <h3><em><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></em></h3>
    <p><?php the_excerpt(); ?>
    <p><a href="<?php the_permalink() ?>">Read more of what God says about "<?php the_title(); ?>" ...</a>
    </p><div class="line"></div></p>
     <?php endforeach; ?>
    		<?php endwhile; endif; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘query_posts, display 1 page and posts from select category?’ is closed to new replies.