0

I have used twitter bootstrap to my plugin. But after install the plugin, it is changing style of the theme that has already bootstrap. How can i avoid this conflict?

2
  • How are you including the style in Wordpress?
    – Tomás Cot
    Commented Aug 17, 2014 at 12:22
  • function newsbox_style_and_script() { wp_enqueue_style( 'bootstrap-style', plugins_url( '/css/bootstrap.min.css', __FILE__ ),array(),'3.0.3'); } add_action( 'wp_enqueue_scripts', 'newsbox_style_and_script' ); @TomásCot
    – Alamin
    Commented Aug 17, 2014 at 13:54

1 Answer 1

1

You should not ship general purpose styles with any public plugin.

There are two typical approaches to this:

  1. Don't ship any styles and rely on simple/expected markup. This works for cases like widgets, with similar enough markup between different themes. Same goes for outputting in content area — any quality theme is presumed to have styling for basic elements.

  2. Make styles precisely specific to your markup. For example only produce output inside container with class/id unique to your plugin. Since you use Bootstrap in your specific case and it uses Less (as opposed to plain CSS) it makes it easy to import and nest rules to produce such stylesheet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.