Thanks @abdelrhman7, that helped.
So the problem is you’re using a different theme. OP is using the Cards Compact theme -as previously pointed out- and you’re using the Cardview theme. So, of course, the code I shared with the OP won’t apply to you.
You need to change the if condition in the code so it checks for the cardview theme name instead of cards-compact. That’s why I was asking you which is the theme you’re using π
Anyways, this is what I’m talking about:
/**
* Adds CSS rules to the Cards Compact theme.
*
* @param string $additional_styles
* @param string $theme_name
* @return string
*/
function wpp_additional_css_rules($additional_styles, $theme_name){
if ( 'cardview' == $theme_name ) {
$additional_styles .= '.wpp-post-title { font-family: sstlight!important; font-size: 14px!important; color: #202224!important; text-decoration: none!important; text-align: start!important; line-height: 22px!important; font-weight: 700!important; } ';
}
return $additional_styles;
}
add_filter('wpp_additional_theme_styles', 'wpp_additional_css_rules', 10, 2);
If you’re using a caching plugin don’t forget to flush its cache before testing this code.
thanks you very much @hcabrera , it’s working π€©π.
-
This reply was modified 6 years, 1 month ago by
abdelrhman7.
-
This reply was modified 6 years, 1 month ago by
abdelrhman7.
Yes, adding the code to your theme’s functions.php file should do the trick.
@hypelifemedia so I gave your issue some thought and here’s what I’m thinking.
The issue is that -as explained earlier- WPP’s themes are self contained component which means they cannot be affected by external rules. So I’m guessing that the theme doesn’t know that your body tag has that CSS class, hence the reason why it ignores your custom rules.
Here’s a workaround for that:
1. Go to Plugins > Plugin Editor and select WordPress Popular Posts from the dropdown.
2. Click on assets > themes > cards-compact > style.css to open this stylesheet.
3. Copy the CSS rules into your theme’s main stylesheet.
4. Go to Appearance > Widgets > WordPress Popular Posts and set Theme to None.
5. Check your website to see if these changes were applied correctly. If so, you’ll see that your popular posts list will still look the same as the Cards Compact theme.
This should allow you to alter how your popular posts list looks without requiring the PHP snippet from before. This also means that the widget will no longer be a self-contained component and so your global CSS rules will affect how the widget looks on your website.
Solved! Thank you very much.
Followed all the steps and it worked with the dark mode seamlessly.
However, the size of the featured images “.wpp-cards-compact li .wpp-thumbnail” appeared smaller so I changed the “max-width” from “100%” to the expected size “90px”.
I also removed the snippet. I didn’t have to make further changes.
Now everything is good.
Thanks again.