Genesis uses the terms post info and post meta to describe the post byline (usually appearing under the post title) and the post categories and tags (usually appearing in the post footer).
I always get these muddled up, hence the need for this canonical post about them.
Post Info (Entry Header)
Filter the contents of post info using the following code. The default output is shown, shortcodes can be swapped from info to meta or vice versa.
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
<?php | |
add_filter( 'genesis_post_info', __NAMESPACE__ . '\\post_info_filter' ); | |
/** | |
* Filter the post info. | |
* | |
* @return string | |
*/ | |
function post_info_filter() { | |
return '[post_date] by [post_author_posts_link] [post_comments] [post_edit]'; | |
} |
Post Meta (Entry Footer)
Filter the contents of post meta using the following. The default output is shown, shortcodes can be swapped from info to meta or vice versa.
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
<?php | |
add_filter( 'genesis_post_meta', __NAMESPACE__ . '\\post_meta_filter' ); | |
/** | |
* Filter the post meta. | |
* | |
* @return string | |
*/ | |
function post_meta_filter() { | |
return '[post_categories] [post_tags]'; | |
} |
thomas
Hi Craig,
Your blog posts are great and very helpful.
For this one, I think the parameter is missing.
function post_info_filter($post_info) {}
function post_info_filter($post_meta) {}
Your thoughts?
Craig Simpson
Hi Thomas, in both cases, you would only need to pass in the parameter if you wanted to modify and return that same parameter (maybe after using a
str_replace()
or something like that). Because I’m returning an entirely different$post_info
/$post_meta
I don’t need to pass in the function parameter (the original).