Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active August 29, 2015 14:28
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 billerickson/a80299a2b46683078472 to your computer and use it in GitHub Desktop.
Save billerickson/a80299a2b46683078472 to your computer and use it in GitHub Desktop.
I copied the function from /genesis/lib/structure/archive.php, renamed the function, then changed the class from "archive-title" to "title"
<?php
/**
* Add custom headline and / or description to category / tag / taxonomy archive pages.
*
* If the page is not a category, tag or taxonomy term archive, or we're not on the first page, or there's no term, or
* no term meta set, then nothing extra is displayed.
*
* If there's a title to display, it is marked up as a level 1 heading.
*
* If there's a description to display, it runs through `wpautop()` before being added to a div.
*
* @since 1.3.0
*
* @global WP_Query $wp_query Query object.
*
* @return null Return early if not the correct archive page, not page one, or no term meta is set.
*/
function be_taxonomy_title_description() {
global $wp_query;
if ( ! is_category() && ! is_tag() && ! is_tax() )
return;
if ( get_query_var( 'paged' ) >= 2 )
return;
$term = is_tax() ? get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ) : $wp_query->get_queried_object();
if ( ! $term || ! isset( $term->meta ) )
return;
$headline = $intro_text = '';
if ( $term->meta['headline'] )
$headline = sprintf( '<h1 class="title">%s</h1>', strip_tags( $term->meta['headline'] ) );
if ( $term->meta['intro_text'] )
$intro_text = apply_filters( 'genesis_term_intro_text_output', $term->meta['intro_text'] );
if ( $headline || $intro_text )
printf( '<div class="archive-description taxonomy-description">%s</div>', $headline . $intro_text );
}
add_action( 'genesis_before_loop', 'be_taxonomy_title_description', 15 );
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment