Filed Under: Genesis, Premium Content
in Genesis is typically used in the below code to display comma separated category links that the post belongs to.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Customize entry meta in the entry footer | |
// http://my.studiopress.com/docs/shortcode-reference/#post-shortcodes | |
add_filter( 'genesis_post_meta', 'sp_post_meta_filter' ); | |
function sp_post_meta_filter( $post_meta ) { | |
$post_meta = 'Filed Under: Genesis, Premium Content Tagged: Custom Shortcode, post_categories'; | |
return $post_meta; | |
} |
Sample HTML output:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span class="entry-categories">Filed Under: <a href="http://genesis.dev/category/category-1/" rel="category tag">Category #1</a>, <a href="http://genesis.dev/category/category-2/" rel="category tag">Category #2</a></span> |
If you would like to add the class property with category slug as its value for each category link, read along.
We are going to create a custom shortcode called [post_categories_plus]
and use it instead of Filed Under: Genesis, Premium Content
like so:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Customize entry meta in the entry footer | |
// http://my.studiopress.com/docs/shortcode-reference/#post-shortcodes | |
add_filter( 'genesis_post_meta', 'sp_post_meta_filter' ); | |
function sp_post_meta_filter( $post_meta ) { | |
$post_meta = '[post_categories_plus before="Filed Under: "] Tagged: Custom Shortcode, post_categories'; | |
return $post_meta; | |
} |
After adding the code below in child theme's functions.php, here's the sample HTML output:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span class="entry-categories">Filed Under: <a href="http://genesis.dev/category/category-1/" class="category-1" rel="category tag">Category #1</a>, <a href="http://genesis.dev/category/category-2/" class="category-2" rel="category tag">Category #2</a></span> |
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
[…] is the equivalent of Post Categories Shortcode in Genesis with Support for Category Slug Classes but for tags instead of for […]