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!
- WordPress post-template null warnings
- get post id from wp_insert_post for get_template_part
- How to suppress template-parts in undescores?
- Fetching Initials of the Commentator in the WordPress Website
- Wpdb get->results to out the the month from the db
- How to add post meta in while loop?
- Display css ONLY on most recent post of specific category?
- Adding function to child theme’s function.php
- Automatically Add Page Links to Nav Menu
- blank white page when post/update/change option etc
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- Function sanitize_title() does not appear to be working
- Need help with pagination
- Get the name of menu item with wp_nav_menu
- Echoing a CSS class based on category of post in a list
- How to add data to a custom field at the wp_users table?
- Display child page content of a specific parent on home page
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]