Displaying a category on a page
-
Here’s the orginal page template:
<?php get_header(); ?> <div id="content"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post_<?php the_ID(); ?>"> <span class="breadcrumbs"><a href="<?php echo get_option('home'); ?>/">Home</a> » <?php the_title(); ?></span> <h2 class="title"><?php the_title(); ?></h2> <div class="entry clearfloat"> <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> </div> <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?> </div> <?php endwhile; endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
How do I modify this template so that I can create a page template wherein it displays all the posts from a specific category..
I did this..didnt work though!
<?php /* Template Name: download */ ?> <?php get_header(); ?> <div id="content"> <?php if (have_posts()) : while (have_posts()) : the_post();?> <?php query_posts("cat=45")?> <div class="post" id="post_<?php the_ID(); ?>"> <span class="breadcrumbs"><a href="<?php echo get_option('home'); ?>/">Home</a> » <?php the_title(); ?></span> <h2 class="title"><?php the_title(); ?></h2> </div> <?php endwhile; endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
Thanks in advance for any help!
- The topic ‘Displaying a category on a page’ is closed to new replies.