In fact you can, I have a folder in my theme directory called /partials/
in in that folder I have files such as latest-articles.php
, latest-news.php
and latest-statements.php
and I load these files using get_template_part()
like:
get_template_part('partials/latest', 'news');
get_template_part('partials/latest', 'articles');
get_template_part('partials/latest', 'statements');
Just dont forget to omit the .php
from the file name.
Related Posts:
- Passing variables to template parts
- get_template_part for template in subdirectory not working
- How to add variables to a template
- Using require_once for parent-directory not working but is working in sub-directories
- Is it possible to override the result of get_template_part()?
- Get template part vs locate template function
- passing argument to get_template_part() or a better way to code
- Templates & CSS – Proper Programming Practice?
- TwentyTen: Overloading template.php files vs. get_template_part
- How to include template according to meta post value
- Using Includes in Templates in Document Head
- How to move style from template file to section?
- Unable to include a template
- Where is the template for the ‘standard’ format of a post in the theme twentythirteen?
- Valid HTML in Template Part
- Remove portion of header code from home page only
- Use a separate template for the home page only
- How to create new template page and template-parts in wordpress theme [closed]
- WP overwrites my setup_postdata() setup
- Including template pages within another template?
- Organize template parts and page templates in folders in regards of template hierarchy
- How to get all template files used for rendering a single post/page?
- Display a custom 404 page without a redirect
- How can I show contents of a template part inside of another page?
- When to use content-pagename.php?
- Theme parts path location dump
- Is it possible to call a template file inside wysiwyg editor? And how?
- WordPress “Blog” template hierarchy
- Get_Template_Part and Template files in TwentyTwentyFour Block Editor
- How to use Class
in Java? - Get name of the current template file
- How do you find out which template page is serving the current page?
- How to change the default registration email ? (plugin and/or non-plugin)
- Passing variables through locate_template
- How do I get the size of an attachment file?
- Adding Page Attributes Metabox and Page Templates to the Posts Edit Page?
- How can i change email template for new user
- Any advantage to using get_header() over include(‘header.php’)?
- Enable page templates. How?
- Use [embed] filter in template files
- What’s the purpose of the paged.php file?
- Should we use get_template_part() in functions files instead of include_once?
- How do you access the Product Short Description in a WooCommerce email template? [closed]
- Prevent comments_template() to load comments.php
- Is there a way to list all used/unused WP templates?
- Page editor missing Templates drop down
- Print WordPress template filename(s) for debugging
- How to force TinyMCE in WordPress to replace newlines with tags and not with
- How to find the posts page (home page) programatically
- WooCommerce: Change template for single product page
- View WordPress page template usage (or unused)
- How to edit contents of dynamic_sidebar()?
- How to check if a shortcode exists?
- Where is get_header(‘shop’) file in Woocommerce templates
- Custom templates folder
- What is the link to my default “archive” page?
- How to add custom content template part for a custom post type on main query using a plugin
- How to get slug of current category in taxonomy template?
- How to show a under construction page for a domain but still be able to work on index.php?
- Change the name of the ‘Default Template’
- Customizing get_the_excerpt() to specific length and “Read More” output.
- How to Rename a Template File?
- get page templates
- Echoing Elementor page content in template, but it doesn’t get styles and some widgets are missing
- Using WordPress templating for HTML emails
- Loading partial templates with AJAX/PJAX
- WP frontend output of custom textarea fields not respecting line breaks. In admin it’s OK
- How do you check if a WordPress template file exist?
- Load entire NextGEN gallery from single thumbnail?
- I put my blog on a subpage, how do I get page title?
- A special single page templates for posts under a category and all its child category
- Custom reset password template after forgot password request
- Outputting Canonical Resource URLs Across a Multisite Network?
- Gravity Forms Custom Templates [closed]
- Child Theme: how to override variables?
- Get the php template file from other theme folder
- How do I get the URL of a specific size featured image?
- Where to store some per-template preferences?
- add/apend templates ‘transparently’ via plugin to currently active theme or child theme?
- stop blog page from using index.php?
- How can I modify the default reset (lost) password email text?
- How to create tag.php
- Template files missing after moving site
- How do I override template-tags.php in twentyseventeen theme
- How can I see what template parts are being called for rendering the viewable page?
- Programmatically change post templates?
- How to hide/redirect the author page
- Tools for Converting an Existing Website Design to a WordPress Template?
- Gutenberg & Pre-formatted Templates: Core Block Attributes
- Restrict a search to a custom post type
- Gutenberg Editor – Template Doesn’t Match Error
- author.php added to template not working on Nginx server
- Test if page is child and has children, if so echo child pages also on grandchild pages
- Need to give custom page template for each language in WPML
- roots child theme can’t override header.php
- How did you incorporate WooCommerce in your own WordPress theme?
- Correct process for a new Page Template?
- How to assign a class to a page with a custom template?
- wordpress – load a template based on the URI
- When calling wp_title(), do you have to create some kind of “title.php” file?