In a PSD > WP project that I am currently working on, the requirement is to show category name linked to corresponding category archive page in a Genesis Featured Posts widget. Using the standard post_categories shortcode displays names of all the linked categories that the post belongs to separated by commas.
![]()
There could be times when you want to display just one category though, like this:
![]()
We can copy the add_shortcode function from genesis/lib/shortcodes/post.php where Filed Under: Genesis, Premium Content is defined and modify it for creating a custom [post_category] shortcode that outputs the first category (link) by adding the following in child theme's functions.php:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
Hi Sri, this gave me a PHP warning when WP_DEBUG was active. Your $atts is undefined. Here’s the fixed code: https://gist.github.com/blogjunkie/a4f6e79fde5940ae5f45e09297d9757f/revisions
Merry Christmas!
Thanks David.
Do you know if it’s possible to merge/accept your revision i.e., automatically updating the two files with your changes w/o manually updating them?