Hi @jas0nw0ng123,
First of all, I need to say that I love this plugin very much, which there are much flexibility on customising the widget.
Thanks for the kind words. I’m really glad to know you like it, and I’m thrilled to see you using one of the new features, the widget themes!
I have encountered a problem when trying to adjust the font size of the post topic of the widget. I have searched for a lot of related topics but still fails to resolve the problem.
I am really stuck here which I can’t adjust the font size with any codes.
Yeah, because the feature is new you won’t find a lot of information about it yet. This topic is actually the first one related to widget themes so in a way you’re already helping future users 🙂
These widget themes are Self-Contained Web Components, meaning they cannot be affected by external CSS like you would normally do when styling regular HTML elements.
There is a way to add custom CSS rules. From the Wiki:
If you want to customize / extend the CSS rules of a given theme, you can use the wpp_additional_theme_styles filter hook.
So, try adding this to your theme’s functions.php file and check again:
function wp65132_additional_css_rules( $additional_styles, $theme_name ){
$additional_styles .= '.wpp-list li {font-size: 1rem} .wpp-list li .wpp-post-title {font-size: 1rem}';
return $additional_styles;
}
add_filter( 'wpp_additional_theme_styles', 'wp65132_additional_css_rules', 10, 2 );
Thanks for your prompt reply! The code works like a charm!
Hi there,
Just another quick question. While the code is working fine, I need to insert it back in functions.php again each time after updating my theme. Is there any way for me to insert the code permanently? Thanks.
Hi @jas0nw0ng123,
If you’re using a theme that gets updated regularly you can either create a child theme and put the code in your child theme’s functions.php file, or you can create a MU plugin and place said code in there.
The former option will allow you to upgrade your theme while still being able to add/retain your customizations, and the latter is theme-independent and will continue to work even if you switch to a different theme.
Since your modifications are CSS related I suggest going with option #1 but either you choose will do the job.