Change Default "Show All" on Category Dropdown

I would like to change the default selection on the Category dropdown to another category on the Products page.

Where can I go to find the code (which module to evaluate)?

Thanks,

Merv (lzw8bk)

  • lzw8bk
    • WPMU DEV Initiate

    Thanks Joe,

    Hard to get my head wrapped sometimes too …

    I probably was not specific enough. Here’s what I have and what I want:

    The Products page has a drop down that lists all the product categories (I have it enabled). The default “select” is set to “Show All.”

    I have the following product categories:

    Featured

    Music

    DVD’s

    Caps

    T-Shirts

    What I would like to have happen is the drop down to default to the “Featured” category. I still want “Show All” in the list, just a different initial default select.

    I found the code in template-functions.php => mp_products_filter. I changed

    ‘show_option_none’ => __(‘Show All’, ‘mp’:wink:,

    to

    ‘show_option_none’ => __(‘Featured, ‘mp’:wink:,

    and got the results I wanted but “Show All” is no longer in the dropdown list.

    If I had the pure html it would be easy to denote “selected” on the item I want to be default. In this dynamic code generation environment, a bit harder to do.

    I guess I could add an “All” Category and apply every product to it among others but tedious for hundreds of products to edit in the production environment.

    Hope this helps.

    Merv (lzw8bk)

  • lzw8bk
    • WPMU DEV Initiate

    Here’s a followup:

    Looking closer in template-functions.php => function mp_products_filter() line 1957 …

    There is a “selected’ key in the $terms = wp_dropdown_categories(array) and set it to the category ID I want to default to and it works exactly the way I want.

    You can mark this question resolved. Thanks.

    Regards,

    Merv (lzw8bk)

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.