In this article I share sample code that answers
Anybody know how to change #genesiswp post meta by post type? Tried if( 'book' == get_post_type() ) {} but I keep getting a redeclare error.
Adding the following in child theme's functions.php will display custom entry meta in archive page and singular pages of a 'books' CPT. The default post meta will continue to appear everywhere else on the site.
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
Will that work with custom taxonomies too or does it need ot be adjusted with custom code for custom taxonomies?
Immediately useful. Thanks for posting this.
Sridhar,
Thanks for the great tutorial. I am using this and http://sridharkatakam.com/single-archive-templates-custom-post-type-genesis/ to try to display a custom post_info based a CPT custom taxonomy. How would I create a custom post_info for a post with a missing taxonomy. For stance I am using this:
add_filter( ‘genesis_post_info’, ‘custom_post_info’ );
function custom_post_info ( $post_info ) {
if ( is_singular( ‘sermons’ ) || is_post_type_archive ( ‘sermons’ ) || is_tax(‘series’)){
$post_info = ‘[post_date] | [post_terms taxonomy="speaker" before=""] | [post_terms taxonomy="series" before=""] | [post_terms taxonomy="passage" before=""] ‘;
}
return $post_info;
}
To display: Date | Speaker | series | passage
But “series” will not always be used. So the above code displays:
Date | Speaker | | passage
How could I modify the post_info to remove the addition ” | ” when series is missing?
Instead of placing the pipe characters in PHP, set them in CSS.
PHP: http://pastebin.com/raw/ws2WqVSt
CSS: http://pastebin.com/raw/mCMek9yG
This should take care of the problem.