Quotes Collection
[resolved] [Bug+fix] Plugin stylesheet overrides theme styles (2 posts)

  1. jrf
    Posted 3 years ago #

    Hiya Srini,

    Love the plugin!

    While adjusting the css styles for the plugin output in my own theme, I found that not all styles are being picked up correctly.

    The reason for this is that the plugin stylesheet is loaded *after* the theme stylesheet therefore effectively overwritting the theme's styling.

    This is bad practise and the advise in the faq to adjust the css in the plugin itself is too, as any changes made there would be overwritten by a plugin upgrade.

    Anyways, just thought I'd fix it. Please accept the below code-patch as a compliment to your plugin. I hope you'll incorporate it into the next version.

    File: quotes-collection.php

    Find on line 376:

    function quotescollection_css_head()
    	<link rel="stylesheet" type="text/css" href="<?php echo plugins_url(); ?>/quotes-collection/quotes-collection.css" />
    add_action('wp_head', 'quotescollection_css_head' );

    replace this with:

    function quotescollection_css_head()
    	if ( !is_admin() ) {
    		wp_register_style( 'quotescollection-style', plugins_url('quotes-collection.css', __FILE__), false, 'v1.5.5.1' );
    		wp_enqueue_style( 'quotescollection-style' );
    add_action( 'wp_enqueue_scripts', 'quotescollection_css_head' );

    Hope this helps & keep up the good work!



  2. Srini G
    Plugin Author

    Posted 3 years ago #

    Hi Juliette, thanks for the feedback, and thanks for the patch, I have included this in 1.5.7.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic