ThemeShaper Forums » Thematic


Styling Sidebar Widget Dropdowns

(2 posts)
  • Started 11 years ago by mgwaters
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. Hello,

    I'm trying to style the default dropdown widgets for both "categories" and "archives". I would like to suppress the title (which I know how to do) and change the default "select category" to instead by the title of the dropdown, which in the default Wordpress instance would be "Categories". I actually want to use a completely different term "sections" instead of categories. Pretty sure I can style the look of the dropdown items, but wasn't sure how to replace the "Select Category" with the term "sections"
    For a visual of what I'm trying to do:

    Posted 11 years ago #
  2. not a thematic question, but i well i've been up awake a while and got a little bored. turns out this is super easy you just need to locate the right filter.

    dig, man, dig!

    in wordpress' includes/default-widgets.php you'll find the Categories widget class

    you'll see the following:

    $cat_args['show_option_none'] = __('Select Category');
    wp_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args));

    which is interesting to us b/c it says that 1. there is a filter we can target and 2. the text we want to change is actually one of the arguments in the array... woo

    so you attack that like you attack any filter (the procedure really is almost always the same... the question is just to find the name of the filter

    i even tested this and got rid of syntax errors

    function change_cat_dropdowns($cat_args){
    $cat_args['show_option_none'] = __('Sections');
    return $cat_args;
    add_filter('widget_categories_dropdown_args', 'change_cat_dropdowns');
    Posted 11 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.