If you read the documentation for locate_template
you’ll see the problem.
locate_template( $template_names, $load, $require_once );
$require_once
(boolean) (optional) If true, the template file will be loaded with the php require_once function. If false, the template file will be loaded with the php require function. This parameter has no effect if $load is false.
Default: true
PHP won’t load your template more than once because you’ve set $require_once
to true.
A simpler API function for this purpose is get_template_part
:
get_template_part( 'post' );
Related Posts:
- Jquery Slider for profile template
- Add Infinite Scroll to Ajax Loaded Category Query
- Load comments per post on click with AJAX
- Using jQuery .after inside loop
- AJAX with loop filtering categories
- How can I fetch loop of post titles via AJAX?
- AJAX handler throws 400 (Bad request) – why?
- pop-up lighbox with AJAX
- Ajax loop in sidebar to load post titles/categories
- Filtering posts by multiple taxonomies
- Ajax loop refresh on click
- The correct way to call posts with ajax
- Chopping up a large ajax request of around 200 posts [closed]
- How to get_template_part using AJAX?
- Category Ajax call
- How do I use AJAX Query in my posts loop?
- angularjs not displaying all posts
- Ajax Button to load more Posts into a timeline
- Get Page content to displayin Bootstrap Modal
- Shortcode in posts called by ajax is not working
- ACF – add a group inside a repeater [closed]
- Scrolling Posts with Ajax
- Get post offset/posts page offset in single post page (outside the loop)
- how to json_encode(); the Loop content so that the encoded array is [“0”:content, “1”:content]
- How to render the single post template with the post name?
- Getting selection of posts based on loop variables via Ajax
- Loop order issue with Ajax filter
- $post is undefined in wordpress loop [ajax]
- Database query and get_user_meta return incorrect data
- Submit form for loop of products of the term with AJAX
- Get gallery in loop through ajax
- How to use `foreach()` in ajax call
- How to avoid appending “null” in Ajax?
- How to manually define the primary loop
- How to solve this script problem in theme directory?
- Active class for my flexslider in WordPress
- Ajax category pagination problem
- Sorting Posts Based On Meta Value Using AJAX
- setup_postdata in “loop-handling” php file called via $.ajax
- Code to check amount of blog posts and add css
- Pass WP post content to a jQuery plugin (Fancybox)
- Load featured article once in a loop
- Ajax request with jQuery without WP_ajax
- WooCommerce – Checkout suddenly stops working [closed]
- AJAX in wordpress theme loop
- How to toggle a div element between two images when click two submit buttons in a wordpress loop?
- Loops for cat links not looping for wordpress site
- How to tell if all posts are only in one category?
- Skip 5 latest post while paging?
- get post images to link to external sources
- How to make the following loop break/stop when it reaches 2 posts (custom post types called Topics)?
- WordPress: query pages except remove one page
- get_post_meta printing empty fields, but it shouldn’t be
- How can I change how my tag pages display?
- Get cat parameter from admin-ajax
- jQuery forms & updating info
- How to get post category and author name for cusmot API?
- How to set variables with AJAX request to use in another function in WordPress
- Search Ajax Call – Use Form Data in Response
- Get URLs for AJAX Filter Checkboxes WordPress
- How to display contact form 7 form in vanilla js without jquery in frontend
- Validating an email input from form field before submit using JQuery, AJAX, and PHP
- Why does PHP called with Jquery AJAX not allow additional php code to be added?
- Ajax Favorite from foreach (how to specify which result result is processed)
- Forcing page to top of the list when using get_pages
- Display full WordPress post under search form using AJAX
- Sort posts according to a numeric value entered with ACF
- How to loop specific Category menu from archive page?
- Custom Header added within Dashboard pages, is this possible with custom template files?
- Woocommerce Variable Product Dropdown for Custom Shop Template
- List page is showing 404
- wordpress mysql / wpdb ajax load more for terms help
- WordPress Select Option Load Custom Fields
- WordPress cascading dropdown selection search based on Parent Page & Child Page
- How do I set the Stewart Search Template to return only published posts in the result
- Properly loop through and paginate page on each function call
- Uncaught TypeError: Cannot read properties of undefined (reading ‘message’) [closed]
- Tracking Visitor LatLng with WordPress using JS, PHP. How to put data which was extract using JS into DB
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- Ajax on the Administration Side of plugin – returns 0
- How to display post tag on each post? [closed]
- Database entry removed on browser refresh, Ajax PHP jQuery
- wc_get_template_part doesnt display the content [duplicate]
- Is it possible to set archive.php instead of index.php to display blog?
- Jquery POST Ajax Return null data in wordpress
- How do I reinit WordPress plugins dynamically using jS?
- WordPress AJAX Request returns 400
- How to add Default Level-0 parent and Level-1 class in WordPress Category in li element?
- Fetch value using AJAX in WordPress
- Why does my WP_Query pagination on a custom page.php only loads the homepage?
- Using is_page_template inside loop
- Updating Post meta (ACF field) from Feed
- Query data after an Ajax insert
- How can I pass additional params to a shortcode while in a loop?
- AJAX not working when clicking load more button, when two terms are present in tax_query
- WordPress finding posts on 404 page
- Jquery php request is returning a weird result
- jquery & ajax getting data from php in wordpress . admin-ajax.php returns 400
- Failed to load resource: the server responded with a status of 500 (Internal Server Error) through wp_admin_ajax.php
- How do I call a value from the datase using ajax