I assume you have a file in templates/masterhead-templatename.php
, and it works, it is ok.
Correct me if I am wrong, you want to locate this file like this masterhead-templatename.php
, basically one folder up, but this wordpress function does not work like this.
If the file exists in the root’s theme folder, it does not recognize it.
It is not supposed to do so.
It searches for a file templates/masterhead.php
, sincetemplates/masterhead-templatename.php
was not found.
The function specification get_template_part( 'templates/masthead', $my_theme->Template);
searches like this:
STYLESHEETPATH/templates/masthead-themename.php
STYLESHEETPATH/templates/masthead.php
TEMPLATEPATH/templates/masthead-themename.php
TEMPLATEPATH/templates/masthead.php
Which file is found, that is included and the searching obviously stops.
Related Posts:
- Define page template in wp_insert_post
- Add custom template page programmatically
- Define custom Page Template without its own .php file
- Filter the query ONLY for the search results page
- Custom page template how to check is_page from functions.php?
- Run Product Filter Javascript On Page Template
- Template tags vs get_template_part() vs functions.php
- Programmatically set page template based on page ID
- How to make unique add_filter to the_content of specific page template files – so each template gets its own addition
- Adjust which tempalte a page uses with a function?
- How to specify which Gutenberg blocks are available in the editor for a page template
- how to change link of some wordpress pages
- Filtering posts by category name based on page’s slug
- is_account_page() change to page slug
- How to enable template page only for a post id page
- Activate small php condition at footer over page template
- Pass parameter to hooked function using custom page template
- different style sheet for just one page template
- Insert template-part inside the content
- Both the require and add_template_part function are not including the file
- Page Template Won’t Load Correct CSS File
- Function to check if custom page is used by page?
- Unable to use get_page_by_title() more than once per page?
- Load templates, pass arguments, and render output from functions.php
- Contain multiple page templates in one PHP custom template file in WordPress?
- How to Override Page Template if URL matches query?
- Probleme shortcode with list author
- How Can I Create a Friendly Slug for a Dynamic Page?
- Enqueue script if not page template
- Is_Page doesnt detect my page
- Pagination won’t work on custom page
- Edit meta fields from within template
- Sending Messages Back to the Template After Processing?
- is_page_template wont allow me to enqueue scripts
- How to use different jquery function of idangero swiper dependant on page template?
- Make a PHP file with a function
- Logout redirect via page template without confirmation?
- Template Redirect Function Only Working When Logged In
- Functions.php code that only runs on localhost?
- hook a functions to change wp-config from functions.php
- Relative URLs and hide /wp-content/themes/
- Check if the user has explicitly set an excerpt
- Slugs as breadcrumbs for Pages
- Shortcode with custom content attribute?
- Add a Post Thumbnail to an RSS Feed with custom size
- Automatically add author’s name to post_tag
- Print Dashboard menu name and link
- Remove_filter (‘the_content’, ‘wpautop’) is not working
- Develop function get_template_part in functions.php
- Ajaxing function in widget class
- How can you limit srcset on a single type of page?
- How to fix Warning: call_user_func_array()?
- wp_register_script(… $in_footer = true) not working
- I want to get product attirbute in the section below
- problem with has_post_thumpnail in foreach loop
- Frontend tag edit/submit form
- Using shortcode content with nested shortcode
- how can I edit flexslider in woocommerce. [Urgent]
- Sections and tabs DRY – WordPress settings API
- How to fetch the name of the active menu?
- Has is_archived() for sites in a multisite changed with WP 4.7?
- Custom function causes a 503 error after a couple of hours
- How can I show my latest tweet in my wordpress blog?
- register_activation_hook for multiple functions
- Undefined index: action with code-snippets to change register page
- How to retrieve the current post’s generated featured image size?
- Why There Is No “get content by ID” Function
- Function shortcode – Set Parameter
- Is there a way to prevent a function/method from being called outside a specific hook?
- get_next_posts_link() returns no result despite available posts
- Randomizing wp_tag_cloud() in child theme
- Nav menus all outputting the same links
- Secondary Menu and Logged In Users
- Add Link to Users List (Backend) to open each users front-end profile
- wp_usermeta – Read from database, but save function broken
- remove/hide wp-editor
- Problems with functions.php! Error! [closed]
- Output comment_author in array
- Problem with shortcode inside a shortcode
- Hide Author By-Line if After Certain Date
- Is there anyway to force is_singular() to be true when not loading template?
- wp_title() return random number
- How to add class dynamically from templates
- How to change form action of wp-login page with a function
- How to add link rel tags on paginated posts?
- How to pass data from a plugin to functions.php
- How to make an If Else on Excerpt Filter
- Translation Function missing text-domain [closed]
- Custom taxonomy not refreshing page on add
- Pagination in Search result
- Custom field not updating via functions upon publishing
- disable WP_error: authentication_failed
- Changing functions.php and .htaccess files
- Shortcode Variations?
- wordpress header leaks into body in a specific template
- How to test for a class (from a plugin) in functions.php
- Child Theme not working – CSS gone
- Sessions in word press [duplicate]
- “woocommerce_output_related_products” not working
- How do i set global variable in a function in wordpress functions.php