Template files are not the right place to add in functions like that. The template file isnt loaded until late in the hook/filter process. Your function should be in functions.php. This way it can be added in before your tempalte files load, and functions that are in use in them can be altered.
Often times wp_title()
is used in the header.php so it possible you are using that, but form the code you show you are filtering functions you are not using. Except maybe in header.php, but its loaded and executed before this custom template file. You also do not show the use of the_title()
so I can not tell how/when/where this would actually filter anything if the function was placed in the right location.
Related Posts:
- How to convert the WordPress meta box Page Attributes->Page Template dropdown to radio buttons?
- How to use Class
in Java? - Is there any way to use get_template_part() with folders?
- Use [embed] filter in template files
- How to edit contents of dynamic_sidebar()?
- Loading partial templates with AJAX/PJAX
- A special single page templates for posts under a category and all its child category
- Where to store some per-template preferences?
- How do I override template-tags.php in twentyseventeen theme
- roots child theme can’t override header.php
- When calling wp_title(), do you have to create some kind of “title.php” file?
- TwentyTen: Overloading template.php files vs. get_template_part
- Stream Video Player does not work with do_shortcode()?
- What is a good way to present templated content in WordPress?
- How does wordpress blocks?
- Which has more impact on site performance? Template overrides or hooks
- Subpage template
- Advanced Custom Fields – display when specific template used?
- What should I put on my index.php?
- How To Create WooCommerce Custom Template For Specific Product?
- How to Use Twig + Timber with Multiple Loops based on Meta Key Value
- Programatically create a page
- Missing .twig files in wordpress theme editor
- How to custom page template for the Gutenberg editor
- Use PHP templates as blocks
- Customize profile.php
- Change wp-signup.php Page Template
- Directly using pure JWPlayer JS (but NOT WP Plugin)
- Login page theming?
- I want to add a custom “all posts by author” by authors name. How?
- Advanced templating / WordPress as a CMS questions
- Redirect template based on permalink rather than $wp_query
- Use same page template for parent and child pages in a theme
- displaying category and subject posts
- How to duplicate a page template but make minor changes to the header?
- if page is parent page redirect to first child with hook / polylang
- Custom templates vs page-slug
- get_template_directory() still returning path to previous theme
- URL / Templating system advice [closed]
- What’s the purpose of $wp_did_header?
- Trying to display short code content in template file with do_shortcode()
- Page template option missing
- Unable to add template to page set as Posts page in WP V 4.6.1
- How to use index.php as a template for archives?
- How to customize WooCommerce templates to avoid override upon update [closed]
- Creating new content types (Pages, posts, testimonials, tigers, oh my!)
- What template is used for viewing Media Library Files?
- Genesis – Adding custom hooks to display secondary navigation
- Use a separate template for the home page only
- Force WordPress to NOT display the manual excerpt
- Can I assign a Folder for Post Formats, without it affecting WordPress’ fallback/hierarchical system?
- Custom Template page not loading get_header() correct?
- AMP version of front page without plugin
- Easiest way to map content (in json) to the view (template)?
- Removing calls to noindex() and wp_no_robots()
- Query the database after get_header() has been included
- /wp-admin/post.php shows 404 template on submit
- Does wp_mail work in frontend tempate file?
- Dynamically generated URL and Content page
- Organize template parts and page templates in folders in regards of template hierarchy
- Which template.php for /blog
- Custom /Page/2/ Template Only
- wordpress – modifying template to show more posts
- How to get all template files used for rendering a single post/page?
- How to insert “get_template_part()” based on Category ID?
- Display metabox galleries on specific page template in admin editor
- Home page not loading after editing header.php file
- How can I include ALL post types in the_post_navigation() links, not just current post type?
- Template includes
- Two different single.php depending on source page
- Attachment URL for an image is loading direct image file
- Fixing media query
- I’ve installed example data on Nominee template but the published site shows another version of the site
- Set og:image programmatically in custom single post with external images
- Displaying all posts of a category in full view on one page using their single.php template
- why does not showing my custom post category list in any template?
- Locating the HTML piece of code in wordpress
- Custom Template doesn’t output result when set as homepage
- Theme keeps going to default files [closed]
- How to adjust only the template gallery
- How can I show contents of a template part inside of another page?
- How to serve a amp template
- Single page applications with WordPress: routes and templates
- Inserting javascript file into theme template?
- Creating custom post-listing templates in twentyseventeen child theme
- Display different list of “Custom Templates” for each Custom Page Type
- Submit form to another template (ugly url)
- Using file outside of template hierarchy for Twitter sign in authentication
- Page Templates Used in Custom Post Type
- List all pages using a specific template on a page
- Is it better practice to create many page templates, or a a few base templates with custom HTML added via TinyMCE?
- Duplicated Template Does Not Load the Same as the Original Template File?
- Blog template PHP [closed]
- load_textdomain won’t load my .mo file
- Output fields manually in Woocommerce email templates
- files disappearing from template
- why does blog page ignore template [closed]
- html blog template to wordpress template
- templates page not showing on gutenberg editor
- How to load php templates from html page (block theme)