How can I use add_filter for a specific page template?
You are almost right. The filter must reside in function.php, and is called to modify the title. You can add the filter conditionally. Use this function is_page_template() to determine if wordpress is rendering your template
Try to modify your function like this:
add_filter('wp_title', 'set_page_title');function set_page_title($title) { global $brand; if (is_page_template('designer.php')) return 'Designer '.$brand['name'].' - '.get_bloginfo('name'); else return $title;}
First of all add_filter
must either be located inside a plugin or in functions.php
file.
Then, maybe you have to set the priority for the filter :
add_filter('wp_title', 'set_page_title',1);function set_page_title() { global $brand; return 'Designer '.$brand['name'].' - '.get_bloginfo('name'); }
And check the <title>
meta in your header.php
theme.
<title><?php wp_title(); ?></title>