• Please don’t put too much time into this, particularly if it is a general WordPress issue, but since you wrote this particular plugin I’ll bet you know an answer even if it is not good news.

    When I add or remove a widget area, either with a plugin like yours or by registering or removing one myself in PHP, the relationship between widget areas and the widgets currently assigned to them is not maintained. The guess is that instead of a property list that stores the widget area’s id as a key and the widget id and values as the data which can then be used as an array at run time WP must just be storing a linear list of widgets in use and applies it to the number of widget areas available, starting from the top.

    It is just like the kids game Musical Chairs. This happens in a huge way when I add or remove a structure from this plugin of course. Lots of nested widget action.

    So am I missing a step when I add my widget area registrations in functions.php? Or am I using WP wrong? Is there a quick fix if WP is just that way?

    I will say that the one time I have seen the problem before is when switching back and forth between themes. When you make the switch the more complex theme will lose its layout on return. That is why I don’t think it is my code or yours that causes the issue.

    Kurt

    https://www.ads-software.com/plugins/responsive-column-widgets/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author miunosoft

    (@miunosoft)

    Hi Kurt,

    Do you mean that the widget settings get lost when switching themes?

    If so, I don’t have a solution for it at the moment.

    There is a topic about it.

    I’ll keep the issue in mind though.

    Thread Starter Kurt Flint

    (@kurtflint)

    That sounds sort of like what I mean. Not that your plugin’s settings get lost, but that the relationship between widgets and widget areas get lost.

    I think it is this bug, just showing in your product.
    Steps:
    Find or create a theme with three or four widget areas.
    Fill all areas with Widgets
    Find a theme with one less widget area, lets say two.
    Change theme to second theme.
    * At this point there should be a widget or two in the unused widget area or even an unused widget area waiting to have widgets moved out.
    Switch back to original theme
    * Widgets will no longer be in original widget areas
    * The widgets in the unused widget store will be missing from their original areas
    * The remaining widgets will have shifted, usually up a number of spaces most likely to match the number of widgets in storage.

    And now for the bad news, all of the above happens any time I add or remove a widget area myself, or one of your grids.In fact I am about to do it now, and I will have to rebuild my whole site’s widget order. If this is just the way WordPress is written, we need to get widgets a lifetime instance ID that they keep until they are disposed of, regardless of which theme is loaded, and then make themes and plugins give guid’s of some sort to their widget areas and keep an index of last known widget area positions for every widget they have known.

    Does that make sense? It doesn’t sound that hard to fix. In fact, I have a project in mind that would cover it, if my assumptions and guesses are all correct and not just a house of cards. It just bugs me, I forgetfully find myself doing it before informal client shows and meetings too much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Losing relationship between widget areas and selected widgets’ is closed to new replies.