// Remove post meta remove_action('genesis_after_post_content', 'genesis_post_meta');
// Customize the post meta function add_filter('genesis_post_meta', 'post_meta_filter'); function post_meta_filter($post_meta) { if (!is_page()) { // Spaces are added to [ shortcodes ] for display. Do not include. $post_meta = 'Filed Under: [ post_categories ], Tagged: [ post_tags ]'; return $post_meta; }}
// Remove the post info function remove_action('genesis_before_post_content', 'genesis_post_info');
// Customize the post info function add_filter('genesis_post_info', 'post_info_filter'); function post_info_filter($post_info) { if (!is_page()) { // Spaces are added to [ shortcodes ] for display. Do not include. $post_info = '[ post_date ] by [ post_author_posts_link ] at [ post_time ] [ post_comments ] [ post_edit ]'; return $post_info; }}
Please note that you do not need to remove the functions before editing them. Hat tip to jim đŸ™‚
You should make a note that it’s not necessary to remove a function, then edit it.
Most people are going to want to remove OR edit, but probably not both. It’s a little unclear that you don’t have to remove to edit.
Good point. Thanks Jim. I was trying to show how to remove or edit as separate actions but I can see where it could be confusing . I will make a note.
How would one modify this so that you could remove post meta for just custom post types?
You could do something like this:
add_action('genesis_before', 'remove_cpt_meta');
function remove_cpt_meta() {
$post_type = get_query_var('post_type');
if( !empty( $post_type ) && ( $post_type != 'post' ) ) {
remove_action('genesis_after_post_content', 'genesis_post_meta');
}
}
Hey Lori,
Thanks for the reply. That snippet didn’t work for me, but this did.
add_action(‘genesis_before’, ‘remove_cpt_meta’);
function remove_cpt_meta() {
if( is_single && ! is_single(‘post’) ) {
remove_action(‘genesis_after_post_content’, ‘genesis_post_meta’);
}
}
I then added another bit of code to remove post info as well:
add_action(‘genesis_before’, ‘remove_cpt_info’);
function remove_cpt_info() {
if( is_single && ! is_single(‘post’) ) {
remove_action(‘genesis_before_post_content’, ‘genesis_post_info’);
}
}
Now I just need a better way to write both pieces of code so that they are more efficient. I’m not a great coder by any measure, so, yeah. =)
Thanks for the help!
Hi Alex,
Glad you got it working đŸ™‚ Didn’t notice that you were only trying to remove the meta from single posts.
For efficiency, you can do this:
if( is_single && ! is_single(‘post’) ) {
remove_action(‘genesis_before_post_content’, ‘genesis_post_info’);
remove_action(‘genesis_after_post_content’, ‘genesis_post_meta’);
}
I haven’t tested it, but I don’t see any reason why it would not work.
WordUp! Thanks for the Tip, Lori. =)
Fabulous!! Thank you for your helpful information! Every since Genesis took away the old forum, it has been so difficult to find the answers I need! Thanks so much!
Where would I put the code? I just want to have the post category and none of the labels like ‘filed under’ or any of the tag info.
Hi Tiffany,
You should put the code in your child theme’s functions.php file. The code below will show only the categories with no labels or tag info:
/** Show post categories */
add_filter( 'genesis_post_meta', 'post_meta_filter' );
function post_meta_filter($post_meta) {
$post_meta = '[post_categories before=""]';
return $post_meta;
}
Thanks Lori but once I added that, it didn’t change anything?
Hmm… that usually works. If you send me a link to an example post, I can take a look and see if I can find a clue as to why it is not working.
Here is one: http://mommygoesgreen.com/2013/03/weekend-inspiration/
I only see the category. Which part shouldn’t be there?