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
- Missing feature image link function
- What’s the difference between home_url() and site_url()
- Remove “Category:”, “Tag:”, “Author:” from the_archive_title
- get_template_directory_uri pointing to parent theme not child theme
- How to customize the_archive_title()?
- remove empty paragraphs from the_content?
- What is the “with_front” rewrite key?
- Why use if function_exists?
- How to override parent functions in child themes?
- wp_enqueue_script was called incorrectly
- Add multiple custom fields to the general settings page
- Ajax call always returns 0
- 400 bad request on admin-ajax.php only using wp_enqueue_scripts action hook
- How long does a deprecated function live in core?
- Solution to render Shortcodes in Admin Editor
- How to add a data attribute to a WordPress menu item
- What’s the difference between esc_html, esc_attr, esc_html_e, and so on?
- remove_action on after_setup_theme not working from child theme
- plugins_url vs plugin_dir_url
- Remove type attribute from script and style tags added by WordPress
- How to run a function every 5 minutes?
- Best way of passing PHP variable between partials?
- Upload Multiple Files With media_handle_upload
- How to display custom field in woocommerce orders in admin panel?
- Adding fields to the “Add New User” screen in the dashboard
- Issues with title-tag and document_title_parts
- How do I get the current edit page ID in the admin?
- How to check if a user exists by a given id
- Why isn’t is_page working when I put it in the functions.php file?
- Add tags to the section via functions.php
- Add image size if page template
- How to create a custom order status in woocommerce!
- Remove Actions/Filters added via Anonymous Functions
- Adding a second email address to a completed order in WooCommerce [closed]
- How to load parent_theme functions.php before child_theme?
- How to load scripts/styles specific for a page
- Programatically add options to “add new” custom field dropdown
- Is there any global functions.php file which works for any theme?
- Excluding iPad from wp_is_mobile
- When should you, and when should you not, use wp_list_pluck()?
- Get the ID of the page a menu item links to?
- Add container to nav_menu sub menu
- Difference between the_permalink() and get_permalink() function
- What’s the difference between WordPress random_int() and PHP built-in function random_int()?
- Child theme – Overriding ‘require_once’ in functions.php
- Link to user’s profile settings page?
- WordPress Enqueue for homepage only, functions.php, wp-framework
- get php variable from functions php and echo it in theme template files [closed]
- Get menu object from theme_location
- Is it ok to use a function to output the text domain name in a wordpress theme
- Displaying the number of updates available in the Admin area
- Trying to use add_action and do_action with parameters
- Use AJAX in shortcode
- Set JPEG compression for specific custom image sizes
- Can the new 4.8v text widget visual editor be removed?
- Prevent “main” WPMU site_url() being returned in functions
- Include files in child theme functions file
- Memorizing syntax
- Custom page with variables in url. Nice url with add_rewrite_rule
- Which WP functions do you need to use esc_html() or esc_url() on?
- Check if post is being published for the first time, or is an already published post being updated
- Display random categories on the front page (Finding and Editing Theme Functions)