Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ravenstar/5368b69215ad1e66c434f937472d7d2a to your computer and use it in GitHub Desktop.
Save ravenstar/5368b69215ad1e66c434f937472d7d2a to your computer and use it in GitHub Desktop.
WordPress :: Divi Theme :: Include Tags In Post Meta When Displayed On Frontend
<?php
/* DON'T copy the first line (above) if your functions.php already has it.
* ----------------------------------------------------------------------- */
function et_pb_postinfo_meta( $postinfo, $date_format, $comment_zero, $comment_one, $comment_more ){
$postinfo_meta = '';
if ( in_array( 'author', $postinfo ) )
$postinfo_meta .= ' ' . esc_html__('by', 'et_builder') . ' <span class="author vcard">' . et_pb_get_the_author_posts_link() . '</span>';
if ( in_array( 'date', $postinfo ) ) {
$postinfo_meta .= '<span class="published">' . esc_html(get_the_time(wp_unslash( $date_format) ) ) . '</span>';
}
if ( in_array( 'categories', $postinfo ) ) {
$postinfo_meta .= '<span class="tag-list">' . get_the_tag_list('', ', ') . '</span>';
$postinfo_meta .= '<span class="category-list">' . get_the_category_list(', ') . '</span>';
}
if ( in_array( 'comments', $postinfo ) ) {
$postinfo_meta .= '<span class="comments-list">' . et_pb_get_comments_popup_link($comment_zero, $comment_one, $comment_more) . '</span>';
}
return $postinfo_meta;
}
/*
Example (untested) css only, adapt to suit your needs.
*/
.et_pb_title_meta_container .published {
display: block;
}
.et_pb_title_meta_container .tag-list {
display: inline-block;
}
.et_pb_title_meta_container .tag-list::after {
content: ' | ';
}
.et_pb_title_meta_container .tag-list a {
padding: 1px 2px;
border: 1px solid #000;
}
.et_pb_title_meta_container .category-list::before {
content: 'Category: ';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment