View Custom Post Types as a List?
-
First, not sure if this should be in How-To or Themes so apologies if this is in the wrong spot. It seems more how-to to me. My question is how to display a list of entries for a given custom post type.
After reading this excellent tutorial about custom post types:
https://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress
and in the “Viewing a custom post type section,” it appears there are two choices to view a page with custom post type data. One is to use single.php for both “normal” post types (e.g. blog) and custom post types or use single-post_type_name.php to display the custom post type only.
When I use single.php for normal and custom post types, and I call up the URL for a page that is from a custom post type, I see the individual post. A good thing. When I use the dedicated single-post_type_name.php template file and use the same URL for the entry, I only see the latest entry for my custom post type, not the post that uses the URL. Like this:
someurl.com/fred-flintstone
shows a post about Barney Rubble because Barney’s post is more recent. When using single.php, however, I see Fred’s data only.
My question: how can I display a page that lists all posts of a given custom post type?
Thanks in advance for any help. Let me know if you need more detail.
- The topic ‘View Custom Post Types as a List?’ is closed to new replies.