Show category

This topic contains 4 replies, has 2 voices, and was last updated by soncha soncha 6 years, 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #16246
    soncha
    soncha
    Participant

    Hi,

    I would like to show the category of the specific post as post class.
    The reason for that is, that the related posts should get a specific border color for each category they are in.

    Is there a chance to realise that somehow? And if not where can I find the php template to maybe change that with anything like this:

    $categories = get_the_category();   
    foreach ( $categories as $category ) {
        echo '<div class=".esc_attr($category->cat_name)."><a>term_id ) ).'">
                    '.esc_html( $category->cat_name ).'
                </a><div>';
        }

    Thanks in advance,
    Sonja

    #16258
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    This could be doable by editing the item template. You can find it in the wp-content\plugins\related-posts-pro\includes\views\rpp.shortcode.php file on line 163: https://i.imgur.com/W1uh5E4.png

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16260
    soncha
    soncha
    Participant

    coool, thanks very much! Saved a lot of headaches and my project!!

    Best regards from Vienna
    Sonja

    #16273
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16274
    soncha
    soncha
    Participant

    Sure!
    Thanks for your help!

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Show category’ is closed to new replies.