On your custom page template, the default loop is working and that’s why the loop is fetching content from the page. You need a custom query in this case. Here’s the code.
<?php
$query = new WP_Query( array(
'post_type' => 'post',
'post_status' => 'publish',
) );
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
$query->the_post();
get_template_part( 'content', 'home' );
}
}
Related Posts:
- Check if a menu is empty?
- Easiest way to show total number of subpages
- Custom excerpt function re-factoring
- Adding wrapper elements in the_date() like in the_title()?
- Getting only direct child pages in WordPress with get_pages
- What is This esc_html_e() i wordpress php?
- Build a content and excerpt grid loop with paging and options for # of posts
- Displaying post per day
- How to loop over custom fields in a page template?
- How to add active class to custom menu using while loop and wp_list_pages
- Custom post type loops with different page templates
- delete an array element when its date expires
- Exclude pages with certain template from wp_list_pages
- How can I loop into two different DIVS without repeating the DIVs
- Switching between custom templates in a post type of the admin menu
- Use template for posts with a particular category grandparent
- page template for attachement page?
- Add a Second Menu to a theme that only support 1 menu
- How to speed up a wordpress function with multiple loops?
- Custom Template 404 for specific custom post type
- Get first URL from post content
- Showing content from one page on another
- how could I load a different template part by page
- How to hide all child pages with post_query?
- Show css depending on activity type in BuddyPress activity-loop [closed]
- get author_name from queried post
- Blog posts repeat
- Change title only in dynamic page
- how to refresh div on template part?
- Populate editor with some content of a page with a page template
- Can’t find infinite loop cause
- Checking array against author id in loop
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- Does wordpress templates always in files or in database?
- Inject class in body when particular page template is used
- Use WordPress function in php file
- Show meta box only for default page template
- WordPress template page name displayed on screen
- Custom Pagination is Broken
- How to call multiple functions from multiple files into a WordPress page template [closed]
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- Create page template via functions.php?
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- use loop to return blog details
- add_filter function concatenate string and locate_template function
- How to get current post category details inside “loop”?
- Template Loop – add switch case php
- Calling function in loop causes repeat data
- Posts are not looping through correctly
- Splitting the_content() by size?
- Strip from or something better?
- Some problems calling a function into sprintf() inside functions.php template file [closed]
- Display additional page templates and a sidebar on plugin activation
- How to Add a cutsom slug to my custom author role
- Prevent header and footer from loading on specific pages with template or plugin
- Products listing check if meta checkbox is checked
- Display articles with a different template in the home page | Solved |
- Contain multiple page templates in one PHP custom template file in WordPress?
- Display metabox galleries on specific page template in admin editor
- How to output the taxonomies that are assigned to each custom post?
- Check if current post in loop is last on current page
- update_user_meta as multiple value but with same meta key
- cURL needing to loop through all “next_page”
- WordPress Ajax filter: Create two loops for different output styles?
- How can I get my pagination loop to display the correct number of total pages?
- How to include a function in a template with template tag
- remove_action() not working in page template – Genesis
- How to sort (orderby) a query done by a template function before the ‘foreach’ loop?
- How fix error in the WordPress loop?
- My query keeps looping infinitely ! how to stop it?
- Retrieving specific images from Media Library
- Calling PHP function doesn’t work in index.php
- Loop returns more items than exist?
- Modify category archive page loop on functions.php
- Problems With Query and/or Template Part and/or PHP
- How can I put a custom field as the link of a button shortcode?
- Pagenav Not appearing on custom Template
- why is this content-template not showing any of my blog-entries?
- Tables not showing divs and loop/php items
- Display custom meta box in my template file
- php “use” not working in template [closed]
- Options.php loop won’t show!
- Adding tawk.to code just before body tag on functions.php file
- ACF: how do I get the fields and its values of a specific group?
- Adding a widget function into the php theme file
- Call to undefined method – Download Monitor
- Read array in php?
- How to get post ID in a Page?
- Remove extract from function
- Undefined offset: 3 in custom function
- How to pass current loop data into nested loop
- Template code to split a post and print a custom field?
- the_date() and the_time() functions display actual date an time instead of published date and time
- Integrate admin plugin into template. Very interesant (live search + autocomplete with wp rest api, in vanilla js)
- Flushing the slug base has no effect and does not change
- Multiple cron jobs vs daily cron job doing multiple things? Which one yields better performance and scalability?
- JQuery modal not loading video on popup, only displaying it after multiple reopenings
- Allow user to select location and then set cookie for location in WordPress
- Merge / Combine two php functions for Previous and Next Link with Thumbnail
- Adding php within a return statement [closed]