Reputation: 87
I want to make the first word of a widget title a different color.
The widget code is this:
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
How can I had a span or a class in there so I can specify a different color in css?
Upvotes: 0
Views: 669
Reputation: 1
I think you can do this by just modifying widget code. Find in your theme the file functions.php
. Next, find the lines:
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
and change them to
'before_title' => '<h3 class="widget-title"><span>',
'after_title' => '</span></h3>',
Add lines your style.css
h3.widget-title span {
background-color: #27b56b;
padding: 2px 9px 2px 8px;
font-size: 14px;
color: #fff;
}
Upvotes: 0
Reputation: 1441
I think you can't do this by just modifying widget code. If you really need first word highlighted, you may look for some javascript, jquery solution like here: First word selector
Upvotes: 1