The MU forums have moved to WordPress.org

Add/change/remove certain widgets from "Design" (7 posts)

  1. ghowner
    Member
    Posted 15 years ago #

    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! :)

  2. lunabyte
    Member
    Posted 15 years ago #

    Unregister the widget with a plugin.

  3. ghowner
    Member
    Posted 15 years ago #

    Sorry to ask, but would you have an example (of getting the widgets to specify)

  4. dsader
    Member
    Posted 15 years ago #

    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.

  5. ghowner
    Member
    Posted 15 years ago #

    Thanks a bunch dsader, I really appreciate it! :)

  6. andrea_r
    Moderator
    Posted 15 years ago #

    And you add widgets by adding them as a plugin. then when the plugin is activated, they show up in the widget area.

  7. 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).

About this Topic

  • Started 15 years ago by ghowner
  • Latest reply from cafespain