-1

this question is regarding plugin development. I created a plugin for my WordPress website. That plugin has a shortcode. Short code containing a form, responsive image upload and preview, rotation and some custom options. The thing is that this form is responsive in my theme, because I write some media query responsive, and this form is actually working good in the fullwidth template.

(1)How to make this plugin output is responsive in another theme also?

(2)How can I use bootstrap in this, because if theme didn't support bootstrap then I need to all it separate, &if theme support bootstrap I don't need to call it again.

1

Your plugin can add additional css (and javascript) files into generated pages. Functions wp_register_style() and wp_enqueue_style() with proper parameters should make it work. To not load Bootstrap more than once, use wp_style_is() function. You can find more in documentation.

  • that i know . But how make it responsive with other theme ? – Felix Oct 7 '16 at 7:06
  • You bring your own bootstrap files and before registering end enqueueing just check, whether there is not other bootstrap files already registered. Function wp_style_is is there for that. I will update my response. – ScheRas Oct 7 '16 at 7:12
  • ok thank you . Please update . But i have other doubt in some theme instead of registering new style using wp_style_is() they are calling the style in theme header . What about this case. – Felix Oct 7 '16 at 7:54
  • There is no simple solution for this case. I think the best way is to inform theme author, tell him that he is doing it in wrong manner. Or send pull request. But you can't save the world. My advice is to use as small piece of Bootstrap as possible and don't care too much about it. – ScheRas Oct 7 '16 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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