How can I change and/or remove widgets from the Design sector of the admin control panel? I've tried /wp-includes/functions.php as specified by another post on a similar topic, but had no luck at finding widgets. Being that the post was around 5 months ago, it could have changed.
So, what file stores the widgets in a way I can change their markup code as well as remove certain ones from being used?
Also, I have widgets for a plugin or two that I've like to add. How do you add widgets?
Thanks a bunch! :)
lunabyte
Member
Posted 15 years ago #
Unregister the widget with a plugin.
Sorry to ask, but would you have an example (of getting the widgets to specify)
function ds_unregister_some_widgets() {
unregister_sidebar_widget('Meta');
unregister_sidebar_widget('Calendar');
}
add_action('widgets_init','ds_unregister_some_widgets');
Look for the name of the widget in wp-includes/widgets.php within the function wp_widgets_init()
Widget API is in the same wp-includes/widgets.php file.
Thanks a bunch dsader, I really appreciate it! :)
And you add widgets by adding them as a plugin. then when the plugin is activated, they show up in the widget area.
cafespain
Member
Posted 15 years ago #
If the code doesn't seem to work try the changing the add_action line to:
add_action('widgets_init','ds_unregister_some_widgets',99);
This should ensure that your remove code is the last action to be run (otherwise it might remove widgets that haven't been added yet, and thus not seem to do anything).