Created
January 19, 2016 17:14
-
-
Save WPprodigy/816ba1827edafe29568d to your computer and use it in GitHub Desktop.
Add subtitle field to Storefront
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 | |
// Display subtitle after the header for posts and pages | |
add_action( 'storefront_single_post', 'storefront_add_subtitle_after_header', 15 ); | |
add_action( 'storefront_page', 'storefront_add_subtitle_after_header', 15 ); | |
function storefront_add_subtitle_after_header() { | |
the_subtitle( "<h2 class='subtitle'>", "</h2>" ); | |
} | |
// Display subtitle in the header for posts | |
function storefront_post_header() { ?> | |
<header class="entry-header"> | |
<?php | |
if ( is_single() ) { | |
storefront_posted_on(); | |
the_title( '<h1 class="entry-title" itemprop="name headline">', '</h1>' ); | |
the_subtitle( "<h2 class='subtitle'>", "</h2>" ); | |
} else { | |
if ( 'post' == get_post_type() ) { | |
storefront_posted_on(); | |
} | |
the_title( sprintf( '<h1 class="entry-title" itemprop="name headline"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); | |
the_subtitle( "<h2 class='subtitle'>", "</h2>" ); | |
} | |
?> | |
</header><!-- .entry-header --> | |
<?php | |
} | |
// Display subtitle in the header for pages | |
function storefront_page_header() { ?> | |
<header class="entry-header"> | |
<?php | |
storefront_post_thumbnail( 'full' ); | |
the_title( '<h1 class="entry-title" itemprop="name">', '</h1>' ); | |
the_subtitle( "<h2 class='subtitle'>", "</h2>" ); | |
?> | |
</header><!-- .entry-header --> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment