Try get_template_part()
.
For example, in your index.php
template file:
/**
* Index template file
*/
/**
* Include header
*/
get_header();
/**
* Include arbitrary file
*/
get_template_part( 'foobar' );
This will include a template-part file, foobar.php
, located in the Theme’s root directory.
Related Posts:
- Can i use php sql functions instead of $wpdb?
- Why include a composer.json file with my plugin?
- Getting paginate_links() ‘end_size’ to display none
- What is the best practice for escaping data URIs?
- Display only text to WordPress loop without loosing the text formatting
- append PHP function to the_content
- Making a follow button, Ajax not talking to php
- How to track a users progress through pages by inserting data into WordPress Database?
- Replace existing content from specific WooCommerce admin orders list column
- How do I get images (with a thumbnail preview) to show in search results?
- How to display blog images using wordpress in existing project
- How do I translate this string – PHP syntax question
- PHPCS: Strings should have translatable content
- mysqli_real_connect() – authentication method unknown to the client Warnings
- php syntax – how to concatenate properly – echo bloginfo(‘stylesheet_directory)
- how to increase custom post value by one most efficiently?
- Escape post image attachments added to template
- Woocommerce product download URL
- Multiple choice in a custom taxonomy
- Calculations in functions.php [closed]
- Get_avatar filter?
- WordPress custom login form using Ajax
- WP dynamic featured image – Can’t get second featured image url
- Why is my cookie not unsetting upon logout? [closed]
- How to remove role=”navigation” from all nav elements?
- Dynamic content in template
- register_taxonomy() take much queries
- wp_dropdown_pages auto submit
- WooCommerce Tabs [closed]
- Limit checklist by the current user
- Adding Meta Tags to a Post using its Tags, Excerpt and content
- Use Tags to initiate Search
- Show About and Contact Us page when they’re clicked in the top menu.
- single.php with different look by category
- WordPress Block developer from exporting Database via PHP
- Displaying posts based on category
- Changing the color scheme based on the url visited
- Clickable image link sends people to wrong URL
- How to send form data from WordPress (Meta Box) to an OData service?
- Issue with custom loop in Archive page
- WooCommerce pages looks unstyled
- class ‘wphpc_PAnD’ not found
- Accessing values from ACF sub field (flexible content area) in PHP
- Creating an image from a custom field
- home.php show blog posts as grid view
- Custom post type permalinks do not appear using the link functions
- Gravatar image url is wrong?
- Loading Posts & Category with Ajax
- This function is deprecated; use mysql_real_escape_string() instead
- How to organize functions.php content
- List all anchor links on a page
- Assign Custom classes to every Excerpt
- Adding a ‘style=’ bit to image_send_to_editor output
- Auto create Nextgen Gallery on post creation [closed]
- Adding a navigation page state to individual blog and portfolio pages
- Inline CSS header style priority function.php Child (no enqueing I think)
- Display Post Title From Select Choice Loop in Advanced Custom Fields (ACF) – WordPress
- orderby meta_value_num is not working, giving default order
- How can I modify this code to make the search box include tags and meta
- Jetengine Forms – Media upload path
- excep tonly one css, don’t load any css
- is_front_page is not working in my functions.php
- Is it possible to update the dataset using update_post_meta
- Change ajax live search results
- Show full post instead of excerpt
- Hide payment method based on user role AND minimum cart value
- Checkbox is not being set
- How do i post data to url with fields?
- Install functionality for push notifications but WP-Theme has oddly-named, hidden source files [closed]
- Update $wpdb query with AJAX
- How to get this .php code from my theme into my plugin?
- how to add functions to my function.php using a child theme?
- Send Notification to all users that followed some author
- Search function not working
- loop to return tags in woocommerce in alphabetical order?
- How to properly escape in ternary operators – Wp Coding Standards?
- Embedded pages by ID are not respecting Private and Draft status
- wordpress form action page not found
- Adding a sidebar to wp-login.php
- What is the best practice for restricting a section to logged in users?
- 301 redirect from webpage to wordpress page in the same root
- add class to background image
- How to merge 2 WordPress sites?
- Adding header function to theme
- wordpress is_main_query() breaks
- Permission functions within wordpress
- how to register a second page-template
- Run php function after html click after page refresh
- Get all the contents of taxonomy and sort by term
- Gallery requires a featured image but does not show it in posts/pages
- WordPress blog set up
- Cannot get custom javascript to execute on page
- How to declare a variable at the bottom of the page and use its value at the top?
- Shortcode working in page.php but not in category.php in wordpress
- Open all external links in new window – need help with the code
- How can a ‘scripts’ directory be hooked into wp_head();?
- Display Current Time using shortcode
- WP and Laravel integration (Updated) [closed]
- running an existing WordPress site from Visual Studio Code?
- get_post_meta returns on side but it doesn’t return on bottom of admin page