Can you make the default category ‘recipe’ and not have any other categories?
Thread Starter
Mrbigp
(@mrbigp)
Thanks, that could work somehow, but ideally they still want to categorise something as maybe, breakfast, lunch or dinner as a minimum.
Maybe in the code there is a hidden field that doesn’t show up in the CMS, called ‘recipe’, maybe it just shows up as a category on the front end. Even hacked if I know what and where to paste a snippet of code…
It sounds like you need to make some custom taxonomies, that should do the trick.
To me it sounds like you are accomplishing what you are trying to do just by making the Custom Post Type, I don’t see why you would need to force the category “Recipe” on the post type “Recipes”.
Why not just query for that post type instead of the category?
Thread Starter
Mrbigp
(@mrbigp)
Ahhh ok, so a custom post type essentially makes itself a separate classification in the database, essentially making all of those custom posts have the same attribute – that of ‘recipe’.
I guess I was thinking it might be a way to make sure that the recipes could be listed in existing WordPress functionality, but I suppose having a link in the menu to the custom posts (“recipes”), or even linking them together in a list elsewhere does the same thing, am I right in that’s what you are saying?
I can also see how custom taxonomy could work, essentially on the right of the edit page in the CMS would be a new heading for the custom taxonomy called “Recipe Type” or similar, then underneath the heading would be all the categories that are only applicable to the post type category. Is that right?
I think it’s all becoming clearer now!
Yes, each post has a post type is defined in the database “Posts” table. The default is just “post”, but when you make a custom one such as “recipe” you can specify to just query posts with post_type “recipe”, giving it its own classification.
Then it is just a matter of using the correct hooks / functions to make the Admin menus display for this post type (Add New, Edit, etc.)
Here is an article from a few years ago that is a good place to start. It’s also using your example “Recipes”. http://idesignsolutions.co/2011/12/03/quick-guide-to-wordpress-custom-post-types
You’re on the right track. Just keep at it!
Thread Starter
Mrbigp
(@mrbigp)
Ahhh I see, I get it now. Thanks south for your help.