If you’re happy to get your hands dirty, this will do the job for you. I’m no WP expert so this may not be the most elegant solution, but it will do what you want.
Edit page.php in your theme folder to include the following before the closing </div>:
<?php if($page_id==11) : ?>
<?php query_posts('cat=2'); ?>
Change the number 11 to the correct ID for your page, and change the number 2 to the correct ID for the category you want to display.
Then add the following, which is just the standard post display lifted from index.php:<
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
</div>
<?php endwhile; ?>
<?php endif; ?>
and then close the IF statement that I added
<?php endif; ?>
That should do the job.
Cheers
n
This worked great for me EXCEPT I had to use
if($post->ID==11)
instead of
if($page_id==11)
Hope that helps!
Ok, I added what you said to page.php, but where does the other stuff go?
I figured it out, thanks to all of you, I’ve been looking for a way to do this for months! Is there any way to make another page with another category?
Thanks!
p.s. For those of you that had the same question as me, it all goes in page.php.
Thanks to Wraith for bringing this up to the top – I had searched and searched for a solution for this and was just about to post, but noticed this at the top of the page.
Thank you nelly for posting the solution – much appreciated!
Don’t be afraid of Category_Templates either. They’re built in to WP and require no “hacking.”
I use category templates as well, but it’s sometimes necessary to have a separate page if you want two category archives. For example, I have my film reviews section customised using the category template (listed in descending chronological order, 5 per page), but I need a second page for an alphabetised list of all films on one page. This did the trick nicely, and didn’t require hacking – all it involved was making a new template. Not hacking at all. 🙂