The Genesis Framework bundles a number of useful shortcodes that allow you to access and output important pieces of information quickly. One of these produces a list of all the categories assigned to a Post and makes them clickable to their respective archives.
The shortcode to produce a clickable categories list is
This shortcode is employed by default in the entry meta, but you can actually use it wherever you like, such as the Post title, the Post body or the entry meta before the content.
As an example, below is the code to display the category list before the content instead of after the content.
You can use the
after attributes to add extra text immediately before or after the category list. The default text before the category list is ‘Filed Under: ‘.
You can also change the separator between the categories. The default is a comma and a space.
before – Text to insert immediately before the category list.
Default: Filed Under:
after – Text to insert immediately after the category list.
sep – The value of this attribute is inserted between all the categories to separate them.
Default: comma + space
[post_categories] outputs the following in order:
<span class="entry-categories">(HTML5) or
- the text passed to the before attribute, if any (default is ‘Filed Under: ‘)
- the tag list
- the text passed to the after attribute, if any
There is one filter on the output of this shortcode, which is
genesis_post_categories_shortcode. The entire marked up category list passes through this filter before being output.
Genesis Simple Edits
[post_categories] has been included since version 1.1.0.
[post_categories] is located in lib/shortcodes/post.php.