change the color in sprintf

Go To StackoverFlow.com

0

I have the code like this

    $output.='<li class="'.$rcclass.'">' . 
/* translators: comments widget: 1: comment author, 2: post link */ 
sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), '<a href="' . esc_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') .
 '</li>';

I want %1$s to have a different color than %2$s. How'd I do that here. thanks

2012-04-04 06:31
by Autolycus


2

Wrap them in <span>s with a specific class, e.g.

<span class='comment-author'>%1$s</span> on <span class='post-link'>%2$s</span>

and then adapt your CSS to show different colors for those classes.

2012-04-04 06:34
by Joey
tried. that didnt work : - Autolycus 2012-04-04 06:48
odd tried this sprintf(_x('%2$s (%1$s)', 'widgets') the color doesnt change but fonts do! - Autolycus 2012-04-04 06:57
Then whatever gets inserted in the placeholders probably has a color set overriding your choice. Try using !important in your own style - Joey 2012-04-04 07:04
Ads