I have searched all over and I am a little confused about my first plugin that I am developing.

I created a shortcode that the user can use on any page they create. The issue is that on a lot of themes the plugin gets pushed out of container width.

I think that most templates are 960px wide, and my plugin is 800px wide (I am not looking for advise on developing with em, percentages, etc. this is a fixed sized plugin).

How can I stop css clashes? I want the container width to be 960px wide. There must be some default id's and classes that I can overwrite in my css.

I would imagine themes use standard naming conventions in order to allow users to switch at anytime.

EDIT: I would also like to remove any sidebar() that is showing on the page...help!?

Anyway, does anyone have advice on this?



If you don't know, and can't control, the content width, then your Plugin shouldn't assume any given content width.

Also, even though templates may be 960px in total width, the content width will almost assuredly be less than that.

If you must apply explicit width to your output, you could try returning the value set for the $content_width global, and then use that value in your generated CSS.

  • What would your suggestion be for a standard width of a plugin going in the main content area of a page? I need to control the width of this plugin because it is somewhat complex and need to make sure formatting stays consistent.
    – mitch
    Nov 30 '11 at 18:59
  • I would recommend re-thinking your output, so that it is not dependent upon a specific content width; or else, base your assumption on a much smaller content width, such as 400px, that is more likely to be well-accommodated by the vast majority of Themes. Nov 30 '11 at 19:18

Well really you shouldn't be looking to modify the theme layout, your's is the addon after all and it should be up to the theme author/admin to make sure their theme works with your plugin if they want to use it.

In any case have you tried using the css !important declaration on you container?


That should force your container's width, then it's up to whoever is using it to make sure their theme is compatible.

  • 1
    Such indiscriminate and arbitrary use of !important is evil, and Plugins should never do such a thing. :) Nov 30 '11 at 19:23
  • I agree entirely :) just offering a possible solution :)
    – patnz
    Nov 30 '11 at 23:10

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.