• Resolved bandicootmarketing

    (@tinkerpriest)


    I am developing a widget that displays Featured Posts in the sidebar. You can select the number of posts and the category. Whatever category is selected ends up being removed from the main section of the index page so as not to have two of the same posts displayed.

    You can see an example at http://wordpressthemes.tinkerpriestmedia.com/?wptheme=Magazine%20Basic

    The problem I have is that when the Widget is removed from the sidebar, the options still exist and the way it is coded, it checks for those options to arrange everything properly on the main page. Is there a way to clear the options when a Widget is removed or is there a function to check if a Widget has been activated or deactivated?

    Thanks.

Viewing 1 replies (of 1 total)
  • Thread Starter bandicootmarketing

    (@tinkerpriest)

    I was able to forage around in the WordPress code and found a solution. There is a function called is_active_widget() that allows you to check if a widget has been added to your sidebar in the backend. You can then use a PHP if statement to make something happen only if the widget has been added.

Viewing 1 replies (of 1 total)
  • The topic ‘Clear the options when a Widget is removed from the sidebar’ is closed to new replies.