The weight of opinion seems to favour using custom post types instead of custom post formats.
I have several custom post types that I want to style in 4 different formats in a way that is not public ie not a category, tag or custom taxonomy.
Custom post formats would seem to provide an ideal solution for this – they’re built-in functionality, easily implemented, come with handy meta box, easily applied with conditional statements etc.
The major draw back being they are not readily customisable – I could rename them for the sake of clarity.
So given the prevailing thought, what would be a better approach to creating the same functionality.
You have several options here so I will clarify what you can do.
Create a custom post type template page using something like
single-customposttype.php
and take advantage of the template hierarchy, http://codex.wordpress.org/Template_HierarchyUse a conditional query for your styling in the loop ( or whatever you’re using), along the line of
if (post type= your custom one) style it this way;
. or use some other WordPress conditionals. http://codex.wordpress.org/Class_Reference/WP_QueryUse a taxonomy for back-end organization, custom taxonomies do not have to be public.
Use post formats for your custom post type, CPT’s can support
post-formats
,http://codex.wordpress.org/Function_Reference/register_post_type
Most people go with option one, but it depends on what you’re trying to do.
Rothbert, you remove the visibility of taxonomies in your theme files.
The crucial difference between “Custom Post Types” and “Post Formats” is the word ‘custom.’
In other words, you cannot change the name of custom post formats. You are limited to the default 10 native to WordPress. You cannot add new post formats. And you cannot change the names of existing ones.
You can enable support for post formats in a CPT. When registering the post type set post-formats in the ‘supports’ argument.
I found this interesting blog piece by Nathan Swartz that basically creates custom post formats for any post type by using a custom taxonomy. I am reproducing his code here so should his blog disappear, his solution persist here.
The basic steps involved are:
here is the code,