Skip to:
Content
Pages
Categories
Search
Top
Bottom

Css style for special reply


  • mehdinjm
    Participant

    @mehdinjm

    Hi, I want to write a CSS style that changes the color of the message sent by the user in the thread. For example, the user sees his messages in green. Is there a css class to style it?

Viewing 1 replies (of 1 total)

  • Robin W
    Moderator

    @robin-w

    add_filter ('bbp_get_topic_class', 'rew_author_current' , 100 , 3) ;
    add_filter ('bbp_get_reply_class', 'rew_author_current' , 100 , 3) ;
    
    function rew_author_current ($post_classes, $topic_id, $classes) {
    	$author_id = bbp_get_topic_author_id( $topic_id );
    	$current_id = get_current_user_id() ;
    	if ($author_id == $current_id) {
    		$post_classes[] = 'rew-current-user' ;
    		$post_classes = array_merge( (array) $post_classes);
    	}
    return $post_classes ;
    }

    will give you ‘rew-current-user’ as a style to add css

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar