Community Forums › Forums › Archived Forums › Design Tips and Tricks › Executive Pro – need help with custom post type post META removal
Tagged: Custom Post Type, executive pro, post meta
- This topic has 4 replies, 2 voices, and was last updated 9 years, 5 months ago by webcami.
-
AuthorPosts
-
November 19, 2014 at 10:42 am #132144webcamiParticipant
Hello,
I just updated a site I'm working on to the newest version of Executive Pro. I had used the following code to remove the post META from the entire site except for the NEWS category. NEWS is the only place I want post meta info.
add_filter( 'genesis_post_info', 'remove_post_info_exclude_news_category' );
/**
* @author Brad Dalton
* @link http://wpsites.net/web-design/modify-post-info-genesis
*/
function remove_post_info_exclude_news_category($post_info) {
if ( in_category('news') ) {
$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit]';
return $post_info;
}
}Now that I've updated to the latest version of the theme, the post meta is showing again on the custom post type for Projects. Can anyone tell me what to change to remove that?
I am not using Genesis Simple Edits - that option removed ALL post meta. My success on the last version of Executive Pro was with the above code.
Thanks for your help!
http://westseattlewordpress.com/sms/projects/cedar-hall-renovation/November 19, 2014 at 2:04 pm #132176David ChuParticipantHi,
Genesis 2 is all finicky unless you use priorities. This is so they can handle all that HTML5 markup. Your code looks pretty good. Maybe try this on for size, and if it doesn't work, play with the last number.add_filter( ‘genesis_post_info’, ‘remove_post_info_exclude_news_category’, 20 );
Cheers, Dave
Dave Chu · Custom WordPress Developer – likes collaborating with Designers
November 19, 2014 at 3:56 pm #132215webcamiParticipantThat didn't do the trick. What is the last number in reference to? Not sure how to adjust it. I thought maybe it was for the category id of what I want to have meta show on, but that was unsuccessful.
Any additional suggestions?
November 19, 2014 at 7:20 pm #132232David ChuParticipantWithout having boots on the ground to investigate, sorry, no. The priority number in a statement like that will alter when the command occurs in the WordPress sequence. In a nutshell, this can make your command happen earlier or later in the WordPress processing. Many commands for Genesis now need to have a priority number to work properly in the Pro versions of themes. And no, it has nothing at all to do with Categories or Tags or anything like that.
You could try official support. I don't have Executive, and they may have specific knowledge about getting that command to work with your theme.
Good luck, D
Dave Chu · Custom WordPress Developer – likes collaborating with Designers
November 20, 2014 at 9:06 am #132278webcamiParticipantI wanted to share the answer to this with anyone else that might need help. I got nothing from contacting support. Although, it did force me to find a result on my own.
This should work if you are trying to remove post info and meta from EVERYTHING but your regular POSTS. I wanted no info on my projects post type, but info on the blog posts.
Here's the link to where I found this solution:
http://www.engagewp.com/remove-custom-post-type-post-meta-genesis/Here's the snippet for the functions.php file:
//* Remove Post Info, Post Meta from CPT
add_action ( 'get_header', 'rv_cpt_remove_post_info_genesis' );
function rv_cpt_remove_post_info_genesis() {
if ( 'post' !== get_post_type() ) {
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
}
} -
AuthorPosts
- The topic ‘Executive Pro – need help with custom post type post META removal’ is closed to new replies.