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?
- XML Parsing Error: not well-formed in FireFox but good in Chrome
- Refresh/reload the content in Div using jquery/ajax
- jQuery’s .on() method combined with the submit event
- How to place comments_template(); outside the loop?
- Endless loop with wp_insert_post and wp_update_post
- Hook into the loop via a plugin, and output something after every X post?
- Two custom loops, pagination, offset
- Bind to WPSetAsThumbnail
- Access to Media Library
- Run The Loop over array of post objects
- Enable infinite scroll on single.php [closed]
- AJAX Contact Form Issue
- How to create a load more post entries like Twitter?
- How to retrieve “sticky” post outside the “loop”?
- code suddenly appearing from my tempate second loop
- ajax, right way to do it and make it works?
- woocommerce get_price_html not pulling in correct price
- How to fix pagination for custom loops?
- Setting value of session with Ajax not working
- Sort results by groups of numbers and letters
- Loop for sticky posts
- Ajax contact form return 0
- Array ids post to function have_post
- Give each posts in a loop a number in sequence
- Simplest ajax form not working when it should
- Data not insert and update through ajax and jQuery in admin page?
- WP ajax requests not stacking?
- get_comments with post_status ‘public’ retrieves NULL result
- Problems with wordpress nonces in Ajax call
- I have broke my pagination, same posts on all pages (index.php)
- Filter existing hook using parameter and foreach loop
- Run “the loop” in a random order
- Which hook to use when adding ajax to viewer-facing side?
- Loops for cat links not looping for wordpress site
- Skip 5 latest post while paging?
- How do I call a value from the datase using ajax
- Where to add my PHP codes for AJAX Jquery to work?
- get the value for ALT is we check to see if an actual ALT value is set, if not we use the caption and if no caption is set we use the title
- How to reload a php script, using AJAX and jQuery
- Updating Jquery object with newly created elements after AJAX call
- Exclude Posts Using Meta Query and User Meta
- Show a list of user posts in the user admin page
- Ajax not updating to database
- Not getting result using ajax on wordpress
- Get custom fields when hover link of post
- get_template_part() to render single page Theme
- Can’t see custom field after the Loop [closed]
- Showing related posts (custom post type) outside of the loop
- The Loop for my theme with static front page is not working
- WordPress loop: Display if posts exist
- AJAX values converted to PHP Variables?
- Showing ads after posts in home page
- wp_mail function not working in user query loop
- Upload multiple files via ajax from an HTML file input