Created
May 28, 2013 21:11
-
-
Save tnorthcutt/5666175 to your computer and use it in GitHub Desktop.
Subtitles for CPT archive issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'genesis_after_entry_content', 'genesis_do_post_title', 20 ); | |
add_action( 'genesis_after_entry_content', 'ehr_do_post_subtitle', 21 ); | |
genesis(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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