Your theme, your sidebars and the plugin & overriding
One of the new features is as a default setting is that the plugin will try have your current themes first sidebar styling apply to the widgets inserted into a page via the shortcode.
Many folks requested this, insisting that absolutely this is what should be happening and why didn’t it? Well..This could be great – Imagine: a plugin that can pick up the theme styling and change it as your theme changes.
The success of this depends very much on how your theme specifies it’s css. Does it always use classes ? – more css will apply. Does it lock the css down by sidebar-id: that css will not apply.
It also depends on what the original widget plugin does with css and js. It may have done something thinking that the widget will always be inside a sidebar and not anticipated being in a page. This the shortcde-any-widget plugin has no control over.
For example: An unwanted effect could be white text on a white background as in the twenty fourteen theme.
If you have an undesired effect with the default setings:
You need to learn the joys of the ‘inspect element’ tools in various browsers or browser web developer, firebug add-ons, so you can see what css is applying to what html. Then you can either change some of the html or override or change the css.
Options if you don’t like the default result:
Use the ‘amr-widget’ class that has been added to the widget wrapping html to override any css.
Tap into a class you already have in your theme:
Change the html that the shortcode-any-widget plugin will use.
eg: don’t like the h3.widget-title styling ? change the title html to h2 in the shotcode parameters
eg: don’t like the ‘aside’ wrapping html styling? change the wrapping html:
If you only using widget, maybe inserting the whole sidebar or widgertarea would give an interesting effect. Sidebar background css may apply.
Let me start off by saying I love this plugin. It open up a ton of possibilities when creating WordPress sites.
Where as I do agree that one should learn the joys of the ‘inspect element’ tools I also believe in keeping things simple.
That is not to say that there is anything simple about your plugin as far as code and work that goes into plugin.
I say simple in respects to I put your shortcode in a page, header, post or sidebar and voila a widget would function there.
I like to upgrade plugins that won’t cause my sidebars to collapse and my widgets to all be moved into the inactive widget area. Part of this is laziness on my part because your plugin always worked all the way up to 1.8.
I also have certain clients that like to get hands-on with their sites and will upgrade plugins when it tells them too much like “Pavlov’s Dogs” (yes I tell them to wait and often falls on deaf ears).
Version 2.1 may have a lot more under the hood but it seems very buggy to me. For now I have to roll back to 1.8 and make sure to tell WordPress it’s 2.1 so clients don’t update.
Again love the plugin and your hard work and looking forward to a stable 2.2.
Thanks for your positive comments.
I agree totally with you re simplicity and it was with great trepidation & care that I added these requested updates. I made it a 2.x update to flag the size of change and added an admin notice again to draw attention to this, as well as a detailed changelog and settings page.
Some things had to change.
1) The sidebar id for one with a capital in it meant that wp didn’t like it and ‘lost’ if when people changed themes. Lots of effort went into testing and setting up code you one wouldn’t lose this page content when a theme was changed. Unfortunately the 2.0 had 1 bug related to this which you experienced which was fixed within a day in 2.1. As far as I am aware there are no other true ‘bugs’. and so there is no immediate plans for a 2.2 until further notice. Always keen to hear about potential bugs, but most of them aren’t.
2) Some of the oddities are because folks were happy/unknowingly perhaps using an earlier ‘bug’ – it happened to work okay for them . The default wrap was not actually working properly before. If the fact that the default wrap is now working, then I think these can be sorted with a shortcode parameter to change the wrap. Unfortunate that it is not seamless but sometimes it is not easy or practical to achieve a seamless upgrade and still have a sensible default option for new people.
Some folks didn’t like that the default wrap wasn’t working – it was a bug that it wasn’t picking up their themes sidebar widget css. I spent quite a bit of effort thinking about what the default should be and testing against the last 4 wp themes – and I thought it pretty magic that I got it to use the themes sidebars and adding code to allow people change the html and add a class name.
I am pondering whether to allow options to totally NOT have your theme’s widget css apply – let the html generated stand by itself. But I suspect that may make no one happy ! Happy to get input on that.
As a rule of thumb, I avoid updating too quickly 😉 and try to read the changelog for any important plugins. So yes clients should not get trigger happy.
Good info. Seems like your trying to integrate consumers ideas into your plugin. I applaud you for that.
Maybe you should have a plugin called amr just-shortcode any widget
and amr shortcode any widget advanced.
I still think the real strength of this plugin lies in the ability to have your widgets show up where you place the short code. I believe it is in that simple (that word again) ability that makes this plugin truly shine.
I think you can have your themes widget css apply. I also think that it should be off by default with a check box to apply the css if that is what you wish.
Widgets get changed around all the time when switching between themes.
It would be great if your plugin had the ability to save all the widgets but then it would be a different plugin.
Personally I can’t believe that this is still a WordPress Problem. Would be great if WordPress saved “WIDGET STRIPS” in the inactive area, in order and separated complete with the old widget section name i.e. “Primary Widget Area” – I can dream.
I like to dialog even if my thoughts seem a bit crazy.
I’m thinking maybe i’ll ad an option to switch the widget classes off. That way one could have a simple- just the widget html,a s well as a sidebarry version
Re saving widgets: 2.1 does save the widgets when you swop themes – saves them in an option and reloads them when new theme activated IF the widgets for shortcode side bar is EMPTY. (ie nothing was ever saved there before).
Unless you were meaning something else when you said save ALL the widgets ? Did you mean keeping a record of what is what in which sidebar (outside of the shortcode one?) – I thought I saw a plugin that tried to do that. Bit tricky since some themes use common sidebar ids but not necessarily with same intention (eg: footer vs sidebar)
Latest wordpress has got a bit better at saving widgets when themes change – it’s tricky as themes can do have totally different sidebars. But yes I agree it could be a little better. (From what I can see data is there, except then wp moves the to ‘inactive sidebar’… but it does remember them when the theme switches back… so still there somewhere… hmmm
anmari, absolutely love this widget – use it all over the place, I believe this topic is addressing what seems to be happening now on my site. (I use the WP 2013 Theme)
There is now a color behind the widgets – and I believe it is being pulled in from the themes colors.
I am trying to figure out how to implement your recommended changes, but am a bit at loss not being a WP developer. Do I need to change code with in the amr-widget or do I need to make changes to my Themes code?
Well, in any case – thanks a ton!
yes colour will be coming from theme.
Do not edit code.
An update should be up tomorrow to allow one to remove the “widget” class from the html to avoid theme css applying if one does not want it to.
See 2.2 just uploaded.
See detailed instructions on home page http://wordpress.org/plugins/amr-shortcode-any-widget/
use widget_classes=none to remove the ‘widget’ class from the wrapping html.
This is usually where themes attach the colour.
- The topic ‘Your theme, your sidebars and the plugin & overriding’ is closed to new replies.