Created
June 29, 2016 20:11
-
-
Save pjhoberman/95cd08ba4eef655ebe7ca89541a50990 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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