0

I just created a WordPress page called Latest Blog Posts where I want to list, in chronological order, all pages from my website using the template name "Blog". The list should contain the title of the pages, the date the pages were published and their thumbnail images.

Is there any WordPress built-in function/query that could easily allow me to do so? If not, how should I proceed when creating new blog pages (using the template "Blog") to allow me to list them all on a single page.

Most of my pages do not use the template name "Blog" but I recently decided to ad a blog section to my website and would love to be able to list all my blog posts on a single page.

  • Use get_pages – Pieter Goosen Nov 30 '14 at 4:24
  • Is there a reason you're using pages for this and not posts? Posts are intended for a date-based blog structure, pages are not. – Milo Nov 30 '14 at 14:34
0

You can create a custom post type called blog. This would group all your "blog" posts together. Once you have that done, create a template file called archive-blog.php, this will be the file that you can use to list all your posts under the "blog" custom post type. For a single post view, the template would be single-blog.php.

These files would reside under the parent directory of your theme (or child theme if you're using a child theme).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.