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?
- How do you access the Product Short Description in a WooCommerce email template? [closed]
- How do I get the URL of a specific size featured image?
- Create Page that uses specific template
- Sharing templates with the JSON API?
- index.php template is used instead of blog page
- Prevent private post 404
- Where is the /blog/ url set from?
- Adding variable to get_template_part
- Set template based on query in URL
- Template tags for Buddypress
- ACF image field to WordPress featured image
- Child theme template file will not load
- How to display only an excerpt of the content with custom post types?
- get_template_part returns NULL
- ACF – Theming Flexible Content
- Is it safe to include a javascript file in a template’s php file?
- Display “large” image size and show caption in attachment page
- For custom templates, is it better to use `template_include` or `type_template`?
- WordPress editable template fields
- Show all parts in multipage post
- Why are 404s not triggering my 404.php template?
- How to show “teaser” posts on blog / archive pages, otherwise full posts
- Content vs Template on custom post
- Can’t format content of Rich Text Editor in Template
- get_file_data to read data for Custom Template File?
- Footer.php not showing?
- PHP include is only working in certain places in my custom WP theme
- lost css when overriding themes templates
- What is the best practice to style archive page 2,3,etc differently than archive.php?
- How to create a post template with two sidebars
- ACF costum date format [closed]
- != and !== both not always working? [closed]
- Page template for a site from network
- WordPress 3.3.1 single post template
- Conditional to determine if search.php page is the current template
- Prevent 404 and serve custom template for custom URL
- Page Templates not using functions.php
- Get template part with CPT and Custom Taxonomy conditionals
- use a custom page to display search results
- When a user registers, create a page from an existing template with their username as the page name
- Theme settings Page: Settings Api vs Update_Options
- How to add description over forum list on bbpress root page
- two active templates for one post
- Where is the code for “Front Page Template”?
- Help Understanding Template Hierarchy
- what is template-name.php
- templates with page teasers Or Featured Items
- If Child or Grandchild of Page
- Is it possible to create custom links inside a template?
- Uncaught Error: Call to undefined function twentytwenty_the_post_meta()
- Timber + MtHaml, or any other HAML-like HTML shorthand
- How to configure my blog page
- BuddyPress : how can I call the template WordPress would have chosen (template hierarchy)?
- Archive only for /year/month, not terms
- Why default template does not show?
- Custom Taxonomy Theme file not routing correctly
- How can I add some blocks to template without changing template file?
- WordPress not picking up custom templates in sub directory
- Retrieving post ID from current page
- Mysterious template change after database import/export
- Is there a way to share a template/markup with the JSON API so that it doesn’t need to be declared both in PHP and in JS?
- Styling own template
- WordPress sites translate dynamically generated Homepages
- changes to templates not showing on server
- Why is this page using the homepage template and not the one it should?
- Problem with permalink structure for WordPress custom post_type archive template
- Make default template two columns?
- Read more button not working
- pass dynamic value to page to pull in categorised post cards
- How to limit block activity (insertion/deletion) to inside of a Block Template on the Admin Screen?
- How to change post template
- WordPress template restored by mistake
- Unload templates; disable parent Template Parts using only “theme.json”