Skip to content

Instantly share code, notes, and snippets.

@tnorthcutt
Created May 28, 2013 21:11
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 tnorthcutt/5666175 to your computer and use it in GitHub Desktop.
Save tnorthcutt/5666175 to your computer and use it in GitHub Desktop.
Subtitles for CPT archive issue
<?php
add_action( 'genesis_after_entry_content', 'genesis_do_post_title', 20 );
add_action( 'genesis_after_entry_content', 'ehr_do_post_subtitle', 21 );
genesis();
<?php
add_action( 'genesis_header', 'genesis_do_post_title' );
add_action( 'genesis_header', 'ehr_do_post_subtitle' );
/**
* Post Subtitle
*
* Displays the post subtitle after the title
* @author Travis Northcutt <travis@brightagency.net>
*
*/
function ehr_do_post_subtitle() {
$subtitle = '';
if (is_post_type_archive()) {
$subtitle = apply_filters( 'ehr_post_subtitle_text', get_post_type_archive_description() );
}
else {
$subtitle = apply_filters( 'ehr_post_subtitle_text', get_field('subtitle') );
}
if ( 0 == strlen( $subtitle ) )
return;
$wrap = 'span';
$subtitle = genesis_markup( array(
'html5' => "<{$wrap} %s>{$subtitle}</$wrap>",
'xhtml' => sprintf( '<%s class="entry-subtitle">%s</%s>', $wrap, $subtitle, $wrap ),
'context' => 'entry-subtitle',
'echo' => false,
) );
echo apply_filters( 'ehr_post_subtitle_output', "$subtitle \n" );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment