Remove Post Meta or Post Info from Custom Post Types
It happens fairly often that we have a client who needs a custom post type as well as the usual blog/news feature. We need post meta and/or post info to show up for the news posts, but we don’t need that information on the custom post type since that information tends to be fairly static, and we don’t really care who the author of an attorney bio is, or who updated a used equipment list. The top snippet is how we pulled that stuff out of CPTs in Genesis v1.
Note that before we can write a function that addresses the custom post type, we have to add another function that makes that possible. We’re going to add this to our standardized functions file (which I’ll write about some other time).
With Genesis 2 out, and changes made to the templates to support HTML5, some of the hooks have changed. Also, you no longer have to write that first function to enable the conditional. If you’re using Genesis 2, follow the second snippet below.
This is just what I was looking for and found it searching for ‘post type custom remove meta’. Appreciate it!
Glad to help, Mike!
Thank you, Dave,was exactly what I was needing!
That’s good to hear, thanks!
Thank you …just what the dr ordered.
[…] I searched for a snippet to remove the post meta from custom post types using Genesis and I found this article from Transmit Studio. The snippet they give works perfectly but it checks only one post type at a […]
Thanks alot Dave. Worked perfectly!
Question for you. What if you have more than one Custom Post Type you want to remove post meta and post info from. How do you hide on CPTNAME1, CPTNAME2, and CPTNAME3?
Glad to help! Take a look at the second snippet up there…I’ve added instructions for testing for as many CPTs as you like.
Thanks for the code snippet, it’s exactly what I was looking for, and was sitting nicely as the top search result 🙂
Don’t you love when that happens?