Code Samples /

Taxonomy Archives

The code below will display an archive of posts by taxonomy term.

taxonomy_{name}.php
<?php 
get_header();

$queried_object = get_queried_object();
$tax = $queried_object->taxonomy;
$tax_name = $queried_object->name;
$tax_term = $queried_object->slug;

if(is_tax()){	
   echo '<h1>' . $tax_name . '</h1>';
   echo do_shortcode( '[ajax_load_more taxonomy="'. $tax .'" taxonomy_terms="'. $tax_term .'" taxonomy_operator="IN"]' );
}
 
get_footer(); 
PHP

« Back to Code Samples