Thematic Taxonomy Template

Working with Custom Post Types can be tricky. Make it easier by using templates to display the taxonomy archive similar to the page.php layout. Copy and paste the content from page.php of your current theme, and remove the section between the content area.

Use this blank section to bring in the content for the post type you’d like to display.

<?php

	

	// calling the header.php

    get_header();



    // action hook for placing content above #container

    thematic_abovecontainer();



?>



	<div id="container">

	

		<?php thematic_abovecontent(); ?>

	

		<div id="content">

			

			

		<ul id="resource_tiles">

                <?php

	            $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );

		        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

		        $args = array(

		            'post_type' => 'resource',

		            'posts_per_page' => 8,

		            'paged' => $paged,

		            'tax_query' => array(array(

			            'taxonomy' => 'type',

			            'field' => 'slug',

			            'terms' => $term->slug // grabs the current term

		            ))

		        ); 

		        

		        query_posts($args);

		        

		        if(have_posts()) : while(have_posts()): the_post();?>

	            

	            	<li>

	            		<?php the_post_thumbnail('medium'); ?>

	            		<div class="resource_tile_content">

		            		<?php the_excerpt(); ?>

		            		<p class="resource_date"><?php echo get_the_date('M j, Y'); ?> <span class="resource_icon"></span></p>

	            		</div>		            	

	            	</li>				       

			       		            

	            <?php endwhile; endif; ?>

		</ul><!-- #resource_tiles -->

		

                </div><!-- #content -->

		

		<?php thematic_belowcontent(); ?> 

		

	</div><!-- #container -->



<?php 



    // action hook for placing content below #container

    thematic_belowcontainer();



    // calling the standard sidebar 

    thematic_sidebar();

    

    // calling footer.php

    get_footer();



?>

 

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.