I understand we can use WP_QUERY and search for posts with the word blog on it and then loop the results, but that probably isn't suitable for production, because it will lead to bugs, so I am wondering what's the recommended way of doing it. I am thinking of using a page template and then loop the post there, but is there a native post type for blog posts?
The issue is there are a lot of pages, a lot of templates, and I am wondering if there's a native page or post type for blog post and how to properly loop using these native types.
https://www.jumboluxurycars.com/blog
It has to look like this.
post
, and in a default install of WP every page that lists posts is that page. If you don't want the homepage to be where your latest posts are listed you can use the settings to set a new blogs page. Also beware of usingWP_Query
to modify which posts WordPress shows, that's what thepre_get_posts
filter is for. By using a second replacement query you introduce lots of new problems that need new workarounds, this is why pagination not working is a common problem ( the pagination is for the main query, not the new customWP_Query
)