Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to remove page titles from Genesis child themes using XHTML and HTML5 methods.
<?php
//* Do NOT include the opening php tag
//* ALL EXAMPLES ON THIS PAGE USE THE NEW HTML5 METHOD
//* Remove page titles site wide (posts & pages) (requires HTML5 theme support)
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
//* Remove page title for a specific page (requires HTML5 theme support)
//* Change '28' to your page id
add_action( 'get_header', 'child_remove_page_titles' );
function child_remove_page_titles() {
if ( is_page( 28 ) ) {
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
}
}
//* Remove page title for multiple pages (requires HTML5 theme support)
//* Change '3645' and '4953' to match your needs
add_action( 'get_header', 'child_remove_page_titles' );
function child_remove_page_titles() {
$pages = array( 3645,4953 );
if ( is_page( $pages ) ) {
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
}
}
//* Remove page titles from all single posts & pages (requires HTML5 theme support)
add_action( 'get_header', 'child_remove_titles' );
function child_remove_titles() {
if ( is_singular() ){
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
}
}
//* Remove page titles from specific posts (requires HTML5 theme support)
add_action( 'get_header', 'child_remove_post_titles' );
function child_remove_post_titles() {
$pages = array( 4953,4648 );
if ( is_single( $pages ) ) {
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.