Skip to content

Instantly share code, notes, and snippets.

@rickrduncan
Last active August 1, 2022 11:16
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save rickrduncan/6949941 to your computer and use it in GitHub Desktop.
Save rickrduncan/6949941 to your computer and use it in GitHub Desktop.
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