• I would like to have multiple instances of a default widget — the Drop Down categories. I want to be able to have the drop down choose only one category. I have been able to edit the wp_widget_categories widget (using exclude) and achieve what I want.

    Is it possible to copy and rename this widget so I can use it several times? I have tried a few variations, without success.

    Many Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • It seems to me there are very little, if any respondes for help with widgets.

    I have posted at least a handful of questions since I upgraded to version 2.3 and not one response.

    Roz

    I’ve just seen your post here, I suspect that you found a solution. All the same, to edit the default widgets you need to edit the wp-includes/widgets.php file, there for cats, is the function`function wp_widget_categories($args, $number = 1) {
    extract($args);
    $options = get_option(‘widget_categories’);

    $c = $options[$number][‘count’] ? ‘1’ : ‘0’;
    $h = $options[$number][‘hierarchical’] ? ‘1’ : ‘0’;
    $d = $options[$number][‘dropdown’] ? ‘1’ : ‘0’;

    $title = empty($options[$number][‘title’]) ? __(‘Categories’) : $options[$number][‘title’];

    echo $before_widget;
    echo $before_title . $title . $after_title;

    $cat_args = “orderby=name&show_count={$c}&hierarchical={$h}”;

    if ( $d ) {
    wp_dropdown_categories($cat_args . ‘&show_option_none= ‘ . __(‘Select Category’));
    ?>`
    this must be what you were editing? you could duplicate this, rename it adjust it to your liking then what.. I’m not sure, maybe someone could fill us in.

    Hhuntington2

    (@hhuntington2)

    I’m a newbie to wordpress and just a neophyte programmer, but doesn’t the admin panel in 2.3 (presentation/widgets) allow you to put several categories widgets on the sidebar and give you the ability to modify each one’s Title, Count, and Dropdown values? Shouldn’t you just be able to add an “Exclude” text box to the form this is reading and propogate it through the rest of the functions?
    I’ve been trying to do this but I’m not having much success figuring out the path. Could you post the code you used to be able to exclude the category IDs?
    Thanks

    Hhuntington2

    (@hhuntington2)

    I guess what I really need to know is where/what handles the form in wp_widget_categories_control (the function that immediately below wp_widget_categories) when it is submitted.
    I can put a text box for exclude in the form so that it appears in the admin but I can’t seem to noodle out the trail from there.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Edit Default Widgets’ is closed to new replies.