Skip to content

Instantly share code, notes, and snippets.

@ChrisCree
Created August 21, 2014 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrisCree/7c73b3e48837d7210a1c to your computer and use it in GitHub Desktop.
Save ChrisCree/7c73b3e48837d7210a1c to your computer and use it in GitHub Desktop.
Add relevant page titles to custom taxonomy archive pages. This code can be dropped in the functions.php file. If used in a taxonomy.php template then omit the is_tax() conditional.
<?php
// Do not copy opening PHP tag above
// Add titles to custom taxonomy archive pages
add_action( 'genesis_before_loop', 'wsm_add_taxonomy_title' );
function wsm_add_taxonomy_title() {
if( is_tax() ) {
global $wp_query;
$term = $wp_query->get_queried_object();
$tax = $term->taxonomy;
$title = $term->name;
echo '<h1 class="entry-title">' . $tax . ': ' . $title . '</h1>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment