taxonomy.php

<?php
/**
   Taxonomy template
 
	To create different taxonomy templates, copy
	this file and create a new...
	
	Ex: taxonomy-my_custom_tax.php
 	
*/
get_header(); ?>

<?php 
// get some info about the term queried
$queried_object = get_queried_object(); 
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id; 
?>
Posts with the term: <?php echo get_queried_object()->name; ?>

<?php //Get the correct taxonomy ID by id
$term = get_term_by( 'id', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>

<?php // use the term to echo the description of the term 
echo term_description( $term, $taxonomy ) ?>


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

<div class="post">
<h2><?php the_title(); ?></h2>
<?php the_content();?>

<div class="meta">
<?php 
/* The post may be associated with other taxonomy terms
	echo the others ... 
 */
$custom_tax = get_the_term_list( $post->ID, 'customtax', '<li>', '', '</li>'); ?>  
<?php echo $custom_tax ?>
</div><!-- meta -->

</div><!-- post -->


<?php endwhile;  ?>
<div class="clear"></div>

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

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


<?php
/*
     Get a ACF Post object on this template
____________________________________________________*/

 // which term?
 $obj = get_queried_object();
 // which field?
 $post_object = get_field('link_to_featured_project', $obj);
 
 if( $post_object ): 

 // override $post
 $post = $post_object;
 setup_postdata( $post ); 

 ?>
 <div class="featured-post-link">
 <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
 </div><!-- featured post link -->
 <?php wp_reset_postdata(); ?>
 <?php endif; ?>

 

Leave a Reply

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

80 − = 79