Change the Genesis Meta Output, Post-Info, Post-Meta and Post-Terms

This tutorial takes you through changing the Genesis Meta Output, the Post-Info, Post-Meta and Post-Terms, post-info is typically at the top of a single post above or below the heading with dates, author and comments info, post-meta is at the foot of the post and includes category and tag info and post-terms applies to custom taxonomy output also rendered at the foot of a post that utilises custom taxonomy.

genesis-icons-entry-meta

You may wish to control the post header or footer meta order or add or omit certain words – in the above screen grab in the header meta the word ‘by‘ is now looking odd (after an icon meta makeover), this can be removed by the genesis_post_info filter by adding in your functions.php

<?php //<~ don't add me in
// Customize entry meta header
add_filter( 'genesis_post_info', 'themeprefix_post_info_filter' );
function themeprefix_post_info_filter( $post_info ) {
$post_info = '[post_date] [post_author_posts_link] [post_comments] [post_edit]';
return $post_info;
}

So now just the meta shortcodes are just returned, which can also be reordered – you could also not use CSS pseudo selectors and instead add in the HTML mark up for the icons directly in the filter before each shortcode like so….

// Customize entry meta
 add_filter( 'genesis_post_info', 'themeprefix_post_info_filter' );
 function themeprefix_post_info_filter( $post_info ) {
 $post_info = '<span class="dashicons dashicons-clock"></span>[[post_date]] [[post_author_posts_link]] [[post_comments]] [[post_edit]]'; return $post_info; } 

For the meta in the footer the genesis_post_meta filter is used…

Same thing applies here you swap them around or take one out – you can also apply to both filters genesis_post_info and genesis_post_meta a label which alters the text that precedes or succeeds the meta in the form of before=”text goes here” or after=”text goes here” within the shortcode like so…

// Customize entry meta footer
 add_filter( 'genesis_post_meta', 'themeprefix_post_meta_filter' );
 function themeprefix_post_meta_filter( $post_meta ) {
 $post_meta = '[[post_categories before="Filed DownUnder: "]] [[post_tags after=" oh my"]]';
 return $post_meta;
 }

Output Custom Taxonomy Terms in Genesis

Back to custom taxonomy, this time how do you output these?

Well you can use the genesis_post_meta filter again, using the post-terms shortcode with taxonomy=”your-custom-term” which outputs a specific set of custom terms that have been registered to use in WordPress.

So an example of this would be like so with a custom taxonomy registered named country_category

If you wanted multiple custom tax terms then just another post-terms shortcode and change the details.

1 Comment

  1. Rob on March 16, 2017 at 7:28 pm

    This is great information. Thank you!

    Here’s a scenario I’m currently trying to resolve.
    Destinations – CPT
    Country – Taxonomy Type (“country_category”)
    State – Child of Country Taxonomy Type
    City – Grandchild of Country Taxonomy Type

    If I have a parent taxonomy (“country_category”) as well as children of the parent taxonomy, how can I get my post_meta [post_terms] to only output the Country. Currently when I implement the above code $post_meta='[post_terms taxonomy=”country_category” before=”Country: “] my post meta info includes Country: USA, Florida, Orlando

    I only want my post meta/post terms to output the Country only, but I want to keep my structure of using child taxonomies.

    Any Advice?

Leave a Comment





%d bloggers like this: