Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function add_theme_support_child() {
error_log('add_theme_support_child');
add_theme_support( 'title-tag' );
}
add_action( 'after_setup_theme', 'add_theme_support_child', 11 );
/**
* Change title of a page conditionally
*
* @return $title - type array
* $title['title'] - Page Title
* $title['tagline'] - Site Tagline
*/
function change_title_for_a_template( $title ) {
error_log('change_title_for_a_template');
// Check if current page template is 'template-homepage.php'
// if ( is_page_template( 'template-homepage.php' ) ) {
$title['title'] = 'Changed title for a template';
// }
return $title;
}
add_filter( 'document_title_parts', 'change_title_for_a_template' );
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.