Support » Fixing WordPress » Where to put code in a Page Template to fetch Category Posts

  • Im trying to create a new Page Template (first one) that displays the posts from a specific category(not full posts, just excerpts).

    Now I have been looking at Page Template Codex on what code to us, just since i’m new to this, what part of it do I have to adjust to fit my theme?

    So far I have copied my page.php and I am wondering where I put the code to fetch the category, here is my Theme page so far(All i have done is change the name at the top and touched nothing else)

    Template Name: Podcast Main
    get_header(); ?>
    	global $wp_query;
    	$postid = $wp_query->post->ID;
    	if ( get_post_meta( $postid, 'post_featpages', true ) == "Yes" ) { ?>
    		<?php include (TEMPLATEPATH . '/featured-pages.php'); ?>
    	<?php } ?>
    	<div id="page" class="clearfix">
    		<div class="page-border clearfix">
    		<div id="contentleft">
    			<div id="content" class="clearfix">
    				<?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } ?>
    				<?php include (TEMPLATEPATH . '/banner468.php'); ?>	
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    				<div class="post clearfix" id="post-main-<?php the_ID(); ?>">
    					<div class="entry">
    						<h1 class="page-title"><?php the_title(); ?></h1>
    						<?php if ( get_post_meta( $post->ID, 'video_embed', true ) ) { ?>
    							<div class="single-video">
    								<?php echo get_post_meta( $post->ID, 'video_embed', true ); ?>
    						<?php } ?>
    						<?php the_content(); ?>
    						<div style="clear:both;"></div>
    						<?php wp_link_pages(); ?>
    <?php endwhile; endif; ?>
    			<?php include (TEMPLATEPATH . '/sidebar-narrow.php'); ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Thanks for your help

Viewing 2 replies - 1 through 2 (of 2 total)
  • esmi


    Forum Moderator

    Have you reviewed a page of posts?

    Yeah, im just new to this all so its a bit daunting. Trying to figure out what needs to replaced to reference the right things in my theme.

    Something that did work was i simply added

    <div id="primary" class="content-area">
          <?php query_posts("cat=5");

    Right after the header, this managed to display the ENTIRE posts but i need excerpts.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Where to put code in a Page Template to fetch Category Posts’ is closed to new replies.