I setup a page called “Recipies”, I then created a category called “Recipies”. I want the page “Recipies” to display a list of all the posts that are in the category “Recipies”
I have searched and believe I need to use a page template. After building one and setting my “Recipies” page to use the following template it does not work.
Using default wordpress theme and the latest stable version.
Page Title: Recipies
Category: Name= Recipies ID= 3
This is the code for my “Recipies” page template:
<?php /* Template Name: Recipies */ ?> <?php get_header(); ?> <div id="content" class="widecolumn"> <?php if (have_posts()) : while (have_posts()) : the_post();?> <div class="post"> <h2 id="post-<?php the_ID(); ?>"><?php the_title();?></h2> <div class="entrytext"> <?php the_content('<p class="serif">Read the rest of this page » '); ?> </div> </div> <?php endwhile; endif; ?> <?php edit_post_link('Edit this entry.', '', ' '); ?> </div> <div id="main"> <?php include (TEMPLATEPATH . '/searchform.php'); ?> <h2>Recipies:</h2> <ul> <?php $my_query = new WP_Query('category_ID=3'); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?> <?php endwhile; ?> </ul> </div> <?php get_footer(); ?>
Where am I going wrong?
- The topic ‘Page Template: Posts by category’ is closed to new replies.