page-custom-post-type.php

<?php
/**
 * Template Name: Custom Template Name 
 */

get_header(); ?>

<?php
	$wp_query = new WP_Query();
	$wp_query->query(array(
	'post_type'=>'custom_post_type',
	'posts_per_page' => 10,
	'paged' => $paged,
));
	if ($wp_query->have_posts()) : ?>
    <?php while ($wp_query->have_posts()) : ?>
        
    <?php $wp_query->the_post(); ?>	
    
    <h1><?php the_title(); ?></h1>
    <?php the_content(); ?>
    
    
<div class="meta">
<?php  
/* Will pull the terms of your Custom Taxonomy 
that is associated with this individual Custom
Post Type. */
$terms = get_the_terms( $post->ID, 'custom_taxonomy' );
	foreach ( $terms as $term ) {
		echo $term->name;
} ?>
</div><!-- meta -->	

<div class="list-terms">
<?php  
/* List all terms associated with a Custom Taxonomy  */
$terms = get_terms('custom_taxonomy');
 if ( !empty( $terms ) && !is_wp_error( $terms ) ){
     foreach ( $terms as $term ) {
       echo "<li>" . '<a href="' . get_term_link( $term ) . '">'  . $term->name . '</a>' . "</li>";
    }
 } ?>
</div><!-- list terms -->
    
    
<?php endwhile;  ?>
<div class="clear"></div>

<?php 
// references pagination function in your functions.php file
	pagi_posts_nav(); ?>	

<?php endif; // end of the loop. ?>

 

Leave a Reply

Your email address will not be published. Required fields are marked *

− 1 = 3