It looks like you are overwriting the comment text with your commentimage_comment_text2
filter, try this to append the ratings text:
add_filter( 'comment_text', 'commentimage_comment_text2' );
function commentimage_comment_text2( $comment ){
$rtt = "<br>Rating";
return $comment.$rtt;
}
ps: you forgot the $comment
input parameter.
Here is a poor man’s skematic picture of the filter flow in WordPress 😉
The filter icon was taken from here.
In your case the filter’s name is comment_text
and your two callbacks are commentimage_comment_text
and commentimage_comment_text2
with priority 10
(the default).
You can view all the callbacks for this filter with this code snippet:
add_action('wp_footer',function(){
global $wp_filter;
printf('<pre>%s</pre>',print_r( $wp_filter['comment_text'],true));
});
On my install I get the following output (in my theme’s footer part)
of all these callbacks with the corresponding assigned pirorities.
I added your two callbacks commentimage_comment_text
and commentimage_comment_text2
so you can see them too:
Array
(
[9] => Array
(
[make_clickable] => Array
(
[function] => make_clickable
[accepted_args] => 1
)
)
[10] => Array
(
[wptexturize] => Array
(
[function] => wptexturize
[accepted_args] => 1
)
[convert_chars] => Array
(
[function] => convert_chars
[accepted_args] => 1
)
[commentimage_comment_text] => Array
(
[function] => commentimage_comment_text
[accepted_args] => 1
)
[commentimage_comment_text2] => Array
(
[function] => commentimage_comment_text2
[accepted_args] => 1
)
)
[20] => Array
(
[convert_smilies] => Array
(
[function] => convert_smilies
[accepted_args] => 1
)
)
[25] => Array
(
[force_balance_tags] => Array
(
[function] => force_balance_tags
[accepted_args] => 1
)
)
[30] => Array
(
[wpautop] => Array
(
[function] => wpautop
[accepted_args] => 1
)
)
[31] => Array
(
[capital_P_dangit] => Array
(
[function] => capital_P_dangit
[accepted_args] => 1
)
)
)