Bring Your Business to Life › Support › Popular Widget › Post category
Viewing 3 posts - 1 through 3 (of 3 total)
- AuthorPosts
- February 22, 2014 at 2:41 am #56947devonmivirMember
Hi, I need little help in display post category somewhere around post title.
To display post date I used:
function modify_pop_recent_title( $title, $post ) { return '<span class="pop-title title">'. $title . '<span class="post-date">' . date_i18n( get_option('date_format'), $date ) ,'</span></span>' ; } add_filter('pop_recent_title', 'modify_pop_recent_title');
How modify it? Should I add new code?
Thanks for help.
February 26, 2014 at 10:31 pm #56994Xpark MediaKeymastermodify your code to this, note that this will only work with categories.
function modify_pop_recent_title( $title, $post ) { return '<span class="pop-title title">'. $title . '<span class="post-date">' . date_i18n( get_option('date_format'), $date ) ,'</span>' . get_the_term_list( $post->ID, 'category', '', ', ', '' ) . '</span>' ; } add_filter('pop_recent_title', 'modify_pop_recent_title');
November 6, 2014 at 4:27 am #201433dzadzeMemberI want to display category as well.
Where should i put this code, in which file? - AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.