To remove the post meta, simply use the following code:
[php]// Remove post meta
remove_action('genesis_after_post_content', 'genesis_post_meta');[/php]
To customize the post meta, simply use the following code:
[php]// Customize the post meta function
add_filter('genesis_post_meta', 'post_meta_filter');
function post_meta_filter($post_meta) {
if (!is_page()) {
$post_meta = '<span class="categories">Filed Under: </span> ';
return $post_meta;
}}[/php]
To remove the post info, simply use the following code:
[php]// Remove the post info function
remove_action('genesis_before_post_content', 'genesis_post_info');[/php]
To Customize the post info, go to my post here How to Edit Author, Date, Time, Comments Link, Tags and Categories (Post Information) in Genesis.
Marco says
Hello, nice roundup of CPT Genesis related tutorials.
I’d like to ask if you have a quick snippet to conditionally replace the post meta in CPTs with their own custom taxonomies; all done via functions.php and not via a custom template.
Cheers
Marco
wpsmith says
Hello Marco,
Here is some ad hoc code that will help get you started without knowing your taxonomies or your custom post types. To customize the post meta, simply use the following code:
[php]// Customize the post meta function
add_filter(‘genesis_post_meta’, ‘post_meta_filter’);
function post_meta_filter($post_meta) {
if (is_post_type(‘my_cpt’)) {
//get your terms via get_terms( $taxonomies, $args ); $taxonomies can be an array of taxonomies
//$myterms = get_terms(‘my_tax’, ‘orderby=count&hide_empty=0’);
//$output = ‘<ul>’;
//foreach ($myterms as $myterm) {
//$output .= ‘<li>’.$myterm->name.'</li>’;
//}
//$output .= ‘</ul>’;
//$post_meta = ‘<span class="mytax">Filed Under:’.$output.’ </span>’;
return $post_meta;
}}[/php]
For more information, check out the WordPress codex for get_terms.
Marco says
Many thanks. I solved by echoing
get_the_term_list
for each custom taxonomy.Amin says
I don’t know what to do with this code – I have a custom post template and wanted to display the custom taxonomies. This gives a blank putting it either in the template or functions file.
To customize the post meta, simply use the following code:
// Customize the post meta function
add_filter(‘genesis_post_meta’, ‘post_meta_filter’);
function post_meta_filter($post_meta) {
if (!is_page()) {
$post_meta = ‘Filed Under: ‘;
return $post_meta;
}}
wpsmith says
Hello Amin,
Place the code in your functions.php file after the require_once statement.
Thanks,
vodkarusskaya says
I was trying to remove the post meta and the post info for hours until i saw this thread. Travis Smith – god bless you!
Ana says
Hi Smith. I want to remove “Filed Under:” and “Tagged With:” but to let only default icons, and function to exist.
Something from: (category icon here) Filed Under: Uncategorized (tag icon here) Tagged With: whatever
To this: (category icon here) Uncategorized (tag icon here) whatewer
Is this possible somehow?
Thanks
Travis Smith says
Hello Ana,
Yes, just use CSS to have the icons appear and delete Filed Under and Tagged With.
[php]<?php
// Customize the post meta function
add_filter( ‘genesis_post_meta’, ‘wps_post_meta_filter’ );
function wps_post_meta_filter( $post_meta ) {
if ( ! is_page() ) {
$post_meta = ‘<span class="categories"></span> [ post_comments]<span class="tags"></span> [ post_tags]’;
return $post_meta;
}
}
[/php]