Skip to content

Instantly share code, notes, and snippets.

@anneallen
Last active September 11, 2015 01:26
Show Gist options
  • Save anneallen/dd47356e78ffadfbc785 to your computer and use it in GitHub Desktop.
Save anneallen/dd47356e78ffadfbc785 to your computer and use it in GitHub Desktop.
Replace Genesis Page tite with Fancy wordy title
//* Remove page title for a specific page (requires HTML5 theme support)
//* This requires a custom metabox '_lob_fancy_title' to be added to the page template
/**
* Create Metaboxes For Page Fancy Title
*/
function lob_fancytitle_create_metaboxes( $meta_boxes ) {
$meta_boxes[] = array(
'id' => 'testimonial-options',
'title' => 'Fancy Page Title',
'pages' => array('page'),
'context' => 'normal',
'priority' => 'high',
'show_names' => true,
'fields' => array(
array(
'name' => 'Title',
'desc' => 'Please use this title if you want to display a different title from that above',
'id' => '_lob_fancy_title',
'type' => 'text'
),
),
);
return $meta_boxes;
}
add_filter( 'cmb_meta_boxes' , 'lob_fancytitle_create_metaboxes' );
add_action( 'get_header', 'child_remove_page_titles' );
function child_remove_page_titles() {
$fancy =genesis_get_custom_field('_lob_fancy_title');
if ( $fancy ) {
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
add_action('genesis_entry_header','child_do_fancy_title');
}
}
function child_do_fancy_title(){
echo '<h1 class="entry-title" itemprop="headline">'.genesis_get_custom_field('_lob_fancy_title').'</h1>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment