The Genesis Framework includes some settings for each category that will automatically output a category headline and intro when they are set. However, it’s a rather repetitive step considering WordPress has a “Category Description” in addition to the category name. Also, if you’re switching to Genesis from another theme and you have a lot of categories, you probably don’t want to manually edit each category to add this information again. Rather than spending time on such a laborious task, this snippet outputs the standard WordPress options for a category’s name and description. Note that this code is very minimal and can be customized however you wish. It simply outputs the category name and description using the genesis_before_content
hook and it does not include any special markup (you’ll need to add it yourself to make it look nice).
UPDATE: This code snippet has been updated to be more flexible so it can be used for categories, tags, and custom taxonomies.
Swag says
Hi,
Thanks for this code, it worked wonderfully in my genesis theme.
Would it be possible to modify it such that it displayed the descriptions only on the first pages of the respective archives?
Waiting in anticipation!
Phil says
thanks for the snippet Ren.
I used
echo ” . single_term_title() . ”;
as you suggested but when I look at the page source it actually comes out as two separate line entries, i.e.
category name
any suggestion to fix this?
Graham
Ren says
Hi, Phil. Do you have a link where I can view this?
Kevin says
Thanks for this! One question, how can I wrap the category title in, say, an h2 tag? I appreciate the help!
Ren says
You’d wrap the title function in the tags you want to use, like so:
This concatenates the h2 tags with the title output.
Todd Jones says
thanks. other approaches use echo category_description( $category-id ); which ends up throwing a couple of php notifications about undefined variables, your solution works. I did move the location to add_action( ‘genesis_before_loop’, ‘rv_output_category_info’ ); and it displays a bit better on my theme that way instead of above content.
Ren says
Excellent! I’m glad it worked for you.