• Resolved mediaeditor

    (@mediaeditor)


    Hi, I’m using the cards compact theme of the plugin in a widget on the sidebar. Before the latest update, the post title mimicked the transition on hover over the link as the rest of the links in my theme, but after the latest update it has been overwritten and it’s now showing underline instead.
    I did tweak the css of this theme before the latest update, particularly the font weight and font size so to look more in harmony with the rest of the theme, but I can’t remember what did I do, if anything, to have the transition also showing on the link as it happens with the rest of the theme. Can you help?
    The plugin is on the sidebar called “Trending now” https://nutritioninvestor.com

    Thanks in advance!

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @mediaeditor,

    Right now the best way to customize widget theme’s CSS rules is via the wpp_additional_theme_styles filter hook. This way, any customizations made to the widget theme will survive plugin updates.

    In your specific case, to have your popular posts links behave the same way as your regular links (transition, color, etc.) add the following code snippet to your theme’s functions.php file:

    /**
     * Style Popular Posts links.
     *
     * @param  string $additional_styles
     * @param  string $theme_name
     * @return string
     */
    function wpp_additional_css_rules($additional_styles, $theme_name){
        $additional_styles .= 'a { text-decoration: inherit; transition: color 0.2s; } a:hover { text-decoration: inherit; color: #ff4f00; }';
        return $additional_styles;
    }
    add_filter('wpp_additional_theme_styles', 'wpp_additional_css_rules', 10, 2);
    Thread Starter mediaeditor

    (@mediaeditor)

    Thanks, Héctor, thanks for your prompt reply!

    Just after posting about my issue, I managed to tweak the theme’s css of the plugin, so it is working as I want it to.

    I’m using a child theme and I copied and pasted the snippet in the functions.php. I tried the snippet after setting the theme’s css back to default, but it didn’t work, unfortunately.

    I’m not a developer just a WordPress enthusiast, so I don’t really mind to tweak the theme’s css to achieve the style I want.

    I saved the code this time around, so hopefully, I’m “update-safe”.

    Plugin Author Hector Cabrera

    (@hcabrera)

    That’s odd. Try restoring the theme’s CSS rules back to default again and when you do please leave a comment here and I’ll have a look @mediaeditor.

    Thread Starter mediaeditor

    (@mediaeditor)

    OK, @hcabrera. I’ll give it another try.
    The theme’s CSS is back to default and have added the snippet to the child theme’s functions.php

    Standing by!

    Plugin Author Hector Cabrera

    (@hcabrera)

    Thanks @mediaeditor!

    Alright, seems we only need to be a bit more specific so our custom CSS rules take over. Have a look:

    /**
     * Style Popular Posts links.
     *
     * @param  string $additional_styles
     * @param  string $theme_name
     * @return string
     */
    function wpp_additional_css_rules($additional_styles, $theme_name){
        $additional_styles .= '.wpp-list li a { text-decoration: inherit; transition: color 0.2s; } .wpp-list li a:hover { text-decoration: inherit; color: #ff4f00; }';
        return $additional_styles;
    }
    add_filter('wpp_additional_theme_styles', 'wpp_additional_css_rules', 10, 2);

    Notice that how instead of assigning our custom CSS rules to all a tags we’re now specifying that it should be all a tags in .wpp-list li. Now the browser should override the styles applied by the stylesheet, using the ones from the code snippet.

    Thread Starter mediaeditor

    (@mediaeditor)

    Master @hcabrera, it worked! You have really made my day. Thank you so very much!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Post title transition versus text-decoration’ is closed to new replies.