- Listing Custom Post Type Entries with a Short Code
- Automatically Displaying Meta Field Values in Easy Content Types
- Using the Automatic Template Creation System in Easy Content Types
- Displaying Custom Post Types in Widgetized Sidebars
- Controlling Page Layouts with Custom Meta Fields
- Querying Custom Post Types in Your Theme Templates
- Creating a Simple Events System with Easy Content Types
- Adding a Simple Image Gallery with the Repeatable Upload Field
Once you have created a custom post type with Easy Content Types, you will want to begin displaying entries from that post type. There are a variety of ways to do it, but one of the easiest by far is using the [ecpt_query] short code included with the plugin. This short code will let you display a list of posts from any post type (including the default posts and pages). It will also let you limit the items displayed, to those filed in a particular taxonomy, or even a particular term within that taxonomy.
The short code, and all of its parameters (with default values) looks like this:
[ecpt_query post_type="post" tax="" terms="" number="5"]
This short code can be placed in any page, post, or text widget. So, let’s say you have a custom post type called “books” and you want to list the latest 8 items published; you would do this:
[ecpt_query post_type="books" number="8"]
Or, let’s say you want to display the latest 4 books published that are filed under the Fantasy genre (the taxonomy is called “genre” and the term is “fantasy”):
[ecpt_query post_type="post" tax="genre" terms="fantasy" number="4"]
If you wanted to include books from the Fantasy and Science Fiction genre, you would use:
[ecpt_query post_type="post" tax="genre" terms="fantasy,science-fiction" number="4"]
Notice that the genre names (they’re called Terms) are lower-cased and have spaces replaced with hyphens. This is because we have to use the Term Slug. The slug is the url friendly name of the term. You can find the slug of your term by going to the custom Taxonomy page (in this case, Genres) underneath the main menu item for the post type the taxonomy is attached to, and looking in the “slug” column.
That’s it. Pretty easy.