Viewing 8 posts - 1 through 8 (of 8 total)
  • Anonymous
    #2979

    Hello,

    SFP loads 2 css files (chosen.min.css and search-filter.css) on all pages. Is it possible to load them only when the plugin is called ?

    It breaks the CSS of my site, which uses tabs.

    Best regards.

    Ross Moderator
    #2986

    Hey David, you should be able to do this from your functions.php… let me have a think about it and I’ll try to get some code together – the problem with the CSS in general is that the plugin has no idea which pages the S&F form will appear on so it must be included – but I think if you know which pages yourself I can get some code to enable/disable CSS for certain pages 🙂

    Thanks

    Ross Moderator
    #2987

    Also, why does it break your tabs? All Search & Filter css is prefixed like .searchandfilter so there should be no conflict, or is this to do with the chozen css?

    Thanks

    Anonymous
    #2990

    Hello,

    It’s possible in functions.php but it seems there’s no handle when you enqueued your styles and scripts :

    wp_enqueue_style( $this->plugin_slug . '-chosen-styles', plugins_url( 'assets/css/chosen.min.css', __FILE__ ), array(), self::VERSION );
    		wp_enqueue_style( $this->plugin_slug . '-plugin-styles', plugins_url( 'assets/css/search-filter.css', __FILE__ ), array($this->plugin_slug . '-chosen-styles'), self::VERSION );

    Regards

    Anonymous
    #2991

    I don’t know why there are some conflicts but my tabs and the content is affected…

    Regards.

    Anonymous
    #3069

    I’d like to reply on what you said there Ross; having an option to disable the entire CSS file from being loaded would be truly helpful! That way it’s up to the developer/designer to style the whole thing. Which, in my opinion, would be best.

    Having the ability to enqueue the stylesheet and script files on ID-base (or whatever other method) would allow people to only load it on the pages they want. I guess this offers the most functionality. Plus it keeps PageSpeed in mind and all that. This way they can load it only when necessary. And I can stop the CSS from loading completely.

    Maybe something like this for the config or functions file?

    define('WPCF7_LOAD_JS', false);
    define('WPCF7_LOAD_CSS', false);

    (Example taken from the contact 7 form plug-in way to enqueue.)

    Ross Moderator
    #3080

    Hey Maarten, I’ll look in to Contact form 7 and see how they do it, might be the best way – always a good idea to see how the best plugins are doing it already 😉

    Ross Moderator
    #4045

    Hopefully looking at doing this this weekend, but there are some essential bug fixes to do first :/

Viewing 8 posts - 1 through 8 (of 8 total)