Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support How to show tags? Reply To: How to show tags?

#3467
Denise
Participant

Hi Tom,

I was able to get the tags to display in the meta data area of WP Show Posts after the title by using the code pasted below.
This is the format: date | category | tag1, tag2, tag3
The date format I’m using is short month and year. (Jan 2018)
This puts pipe separators between each item. And the separator for multiple tags is a comma.

add_action( 'after_setup_theme','tu_move_post_meta' );
function tu_move_post_meta() {
    remove_action( 'wpsp_after_title','wpsp_add_post_meta_after_title' );
    add_action( 'wpsp_after_title','wpsp_add_custom_meta' );
}
function wpsp_add_custom_meta() {
    $cat_title = single_cat_title("",false);
    $year  = get_the_time('Y'); 
    $month = get_the_time('m'); 
    $date = '<a href="https://www.mydatapal.com/' . $year .'/'. $month . '/">' . get_the_time('M Y') . '</a>';
    $cats = get_the_category_list( ', ');
    $tags = get_the_tag_list(' | ',', ');
    echo '<div class="mdp-meta">' . $date . ' | ' . $cats . $tags . '</div>' ;
}

Not sure if that’s the most elegant solution, but it worked =)
Thanks again for the awesome support and plugin!
~ Denise