Post category

Tagged: ,

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #56947
    devonmivir
    Member

    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.

    #56994
    Xpark Media
    Keymaster

    modify 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');
    #201433
    dzadze
    Member

    I want to display category as well.
    Where should i put this code, in which file?

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.