DaveSandwich Posted October 22, 2017 Share Posted October 22, 2017 I have added the following code to my functions.php but its not changing the page name. I have both file name and template name set to "page-FullWidthdynamic.php" I thought "is_page_template" referred to the template name rather than the file name within the themes/child themes folder. Template Name: /** * Template Name: page-FullWidthdynamic.php * @package WordPress * @subpackage Themetemplate */ functions.php code: function filter_wp_title( $title ) { // Change page title if page template is: if ( is_page_template( 'page-FullWidthdynamic.php' ) ) { return 'life is good'; } // Otherwise, don't modify the document title return $title; add_filter( 'wp_title', 'filter_wp_title' ); } Link to comment Share on other sites More sharing options...
phpmillion Posted October 23, 2017 Share Posted October 23, 2017 Maybe your page-FullWidthdynamic.php file is located in some subdirectory inside your template directory? If that's the case, you need to include subdirectory name too. It's also hard to tell where and how you use the code, but be aware that this function doesn't work well inside loop. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.