I’m faced with the following guideline for a contracting job.
Post Type vs. Post Format
Avoid custom Post Types and embrace Post Formats! Post formats are supported by WordPress core, and are already activated in the Starter
Theme. You can assign unique styles, formatting and function to post
formats. If the client switches themes in the future, WordPress will
still recognize the formats you have invoked as long as they are
activated in the function sheet of the next theme.Post Types need to be registered in the functions file of your theme and will not be as easily transferable when the time comes for a new
theme to be activated. In most cases, the need to create a post with
multiple key values and functions can be satisfied by a dedicated post
format that makes use of custom fields, featured images, and so many
other functions already available through WordPress core.Use your best judgement!”
While I understand the point, and that when building a website that plans on switching themes at the drop of a hat, that formats can be really useful – I’m having a hard time going through with it.
The website has pages, and an external API feed for what would probably normally be ‘posts.’ Then there are a few sections that loop through things like FAQs and food-menu items.
I currently have a custom post type for FAQ’s and Food-Menu items. The ‘posts’ are unlikely to be used, but I’m reserving them for a possible ‘blog’ or ‘news.’
What seems to be suggested, is that I just pick a format… like ‘aside’ and then use that as the FAQ’s – and then maybe – take ‘quote’ and use that for the menu items. Then – all the data would be under ‘posts’ which is suggested to be more future-friendly.
I don’t want to be a jerk and just go against the grain… but this seems much less intuitive. The client will have to go to ‘posts’ and then all the FAQs and Menu items will be all mixed up. Then if there is a News section later… they’ll be News, and FAQ, and Menu-items. The client will probably forget to check the formats and be confused – and have to call my contractor for help.
If you compare these 2 sentences (one from each case)
“If the client switches themes in the future, WordPress will
still recognize the {post}formats you have invoked as long as they are
activated in the function sheet of the next theme.”
and
Post Types need to be registered in the functions file of your theme and will not be as easily transferable when the time comes for a new
theme to be activated.
…then what is really the difference. Either way, a small block of code needs to be included – or neither of them will work.
It’s more likely that this data will be aggregated to a JS framework in the coming years than another WordPress theme ~ in which case the data is much messier in my eyes. I would Prefer the Custom Post Type when using the WP-API for say, an Ember App.
The custom-post-types as is – have no place in any ‘feed’ outside of this site. If I wanted FAQs in a feed – I may have used the post format ‘aside’ and a category.
If the site is built out with lots of Advanced Custom Fields – and is broken up into tons of partials – and built with stylus and concatenated bower components, and special functions, I don’t really see this in the world of sites that are just ‘theme – interchangeable’ anyways. Ensuring that a small block of code to register the Custom Post Type is the least of the worries. (It should be noted that in general I have not used WordPress with themes in mind – and only from scratch for very tailored sites.. I’ve never used a widget etc – so I may be ignorant of common practices)
I’m wondering if I should have just included 12 scripts in the head and written the css without a preprocessor? But that just seems rude… and wouldn’t make transferring to another theme easier…
In what cases would each respective style of splitting up site data be more future proof? Is there really any chance of Custom Post Types going away? I thought that the post formats were just a bonus for microblogging – and that most people were actually upset they made it into core.
I know this is on the edge of opinion, but it’s really not to me. I want to do what’s best – but it’s really hard for me to believe that an ungrammatical choice of a micro-bloging sub-format would be best.
The end users are often busy and they need a clear UI. Custom post types are a clear winner here. – But am I doing my client a disservice by “Using my best judgement” – and going to with Custom post types over Post formats?
Please give objective use-cases for each path.
Here are some thoughts on the subject:
https://managewp.com/wordpress-post-formats-blogging
In IRC and other places I’m getting almost 100% ~ “If you are making FAQs – those are not posts, and should be Custom post types.” I’m getting “Don’t use the formats for this” ~ but not much proof that one is more future friendly than the other.
Take this pretend API URL though for example of how each would look:
http://somewebsite.com/cms/wp-json/wp/v2/faqs
vs
http://somewebsite.com/cms/wp-json/wp/v2/posts?format=aside&category=faq
My attempt to describe the 2:
-
Post formats are for styling the post in certain scenarios and for
micro-blogging when you want different post categorizations in a
feed. -
Custom post types are for groups of data that are not posts.
BUT – is either less future proof… and if post-format is – is the post-format so much better – that I should forgo an intuitive interface for the user? – If so, I’ll do what’s right.
Post Type vs. Post Format
[1]
Post formats are supported by WordPress core, [2]and are already activated in the Starter[3]
Theme.You can assign unique styles, formatting and function to post
formats.If the client switches themes in the future, WordPress will
still recognize the formats you have invoked as long as they are
activated in the function sheet of the next theme.[4]
Post Types need to be registered in the functions file of your theme and will not be as easily transferable when the time comes for a new[5]
theme to be activated.In most cases, the need to create a post with[1]
multiple key values and functions can be satisfied by a dedicated post
format that makes use of custom fields, featured images,and so many
other functions already available through WordPress core.Use your best judgement!”
- They are both in supported in WP core.
- Not everyone will use the starter theme
- Both can be styled and customized equally.
- Both need to be registered in the functions file
- Needs can be satisfied by post-formats, true – but no evidence to be ideal
All of these statements seem to cancel each side of the argument out.
The only caveat I could find:
From the docs: https://codex.wordpress.org/Post_Types
A word about custom post types as a plugin In order to avoid breaking
a site on theme switching, try to define custom post types as a
plugin, or, better as a Must Use Plugins. This way you won’t force
users into using a certain theme.
“Must use plugins”
https://codex.wordpress.org/Must_Use_Plugins