WordPress.org

Support

Support » Plugins and Hacks » Question: how to update one widget when another is saved/added?

Question: how to update one widget when another is saved/added?

  • Hi there,

    Summary:
    Is there a way to update widget A when widget B is modified/added/removed?

    Details:
    I’ve create an “alias” widget that outputs the content of any other active widget. In the admin, this widget has a drop-down <select> element that has an option for every other active widget. I would like the <select> menu to update when another widget is added/removed, and am not sure how to achieve this. In case this is unclear, here’s an example:

    Save I have one alias widget and two other widgets: one text and one calendar. So the <select> in the alias widget shows:
    – text-1
    – calendar-1

    Say I then drag a new pages widget into the sidebar. As soon as the widget is added, i would like the <select> in my alias widget to auto-update to the following:
    – text-1
    – calendar-1
    – pages-1

    Same goes for deleting the widget or moving it to an inactive sidebar – I would like the <select> to then auto update back to:
    – text-1
    – calendar-1

    Is there a simple way to make this happen? Is it an ajax solution? Seems to me that I need to trigger the update function in my alias widget class whenever another widget is updated – does that sound right? If so, what filter/actions might I be looking for?

    Thanks a ton, ya’ll – appreciate the help!
    – Mickey

  • The topic ‘Question: how to update one widget when another is saved/added?’ is closed to new replies.
Skip to toolbar