Results 1 to 5 of 5

Thread: Parent- & Sub-Category Dropdown Menus

  1. #1
    Thread Starter
    Senior Member jakesterz's Avatar
    Join Date
    Aug 2009
    Posts
    194
    Thanks
    0
    Thanked 1 Time in 1 Post

    Parent- & Sub-Category Dropdown Menus

    From this thread: viewtopic.php?f=11&t=209#p4264

    I have cities/regions as parent categories, each with a lot of sub-categories beneath. I'd like to be able to have TWO dropdown menus on the listing submission form, one for the parent (city) and one for the sub-categories beneath.

    I think this function might do it, but I'm not really knowledgable enough to make it work. Anyone?

    http://codex.wordpress.org/Function_Ref ... categories

  2. #2
    Founder dcowgill's Avatar
    Join Date
    Mar 2009
    Location
    San Francisco, CA
    Posts
    1,939
    Thanks
    66
    Thanked 135 Times in 99 Posts

    Re: Parent- & Sub-Category Dropdown Menus

    ClassiPress uses the wp_list_categories function

    Your customization would take some work more on the backend and deciding how you'd like to save the 2nd category listing. The current category dropdown uses the standard wordpress category functionality which is easy. It's the 2nd dropdown you'd have to create a custom field for since it WordPress can't handle it natively.

    You would need to create another wp_list_categories function and use the "child_of" parameter set to 1 (i believe) which will only show sub-categories.

    Then modify the current wp_list_categories function and use the "depth" parameter set to 1 to exclude sub-categories.

    You'll then need to edit the post_form.php file and save it into a new custom field. Then add it to the appropriate places to display on the pages.

    If you aren't good with coding, I recommend you hire someone to do this mod for you.

  3. #3
    Thread Starter
    Senior Member jakesterz's Avatar
    Join Date
    Aug 2009
    Posts
    194
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Parent- & Sub-Category Dropdown Menus

    Quote Originally Posted by dcowgill
    ClassiPress uses the wp_list_categories function

    You would need to create another wp_list_categories function and use the "child_of" parameter set to 1 (i believe) which will only show sub-categories.

    Then modify the current wp_list_categories function and use the "depth" parameter set to 1 to exclude sub-categories.
    How would I designate what parent the sub-cats in the list will belong to since the user will be choosing that in the previous dropdown?

  4. #4
    Thread Starter
    Senior Member jakesterz's Avatar
    Join Date
    Aug 2009
    Posts
    194
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Parent- & Sub-Category Dropdown Menus

    Quote Originally Posted by dcowgill
    If you aren't good with coding, I recommend you hire someone to do this mod for you.
    Thanks. I'm NOT good with coding, but I do want to learn to do these things myself. I generally take way longer than I should because I like to do it myself. But I have already added some fields to the form so I can do that, and I've looked at the code for that WP function.

  5. #5
    Thread Starter
    Senior Member jakesterz's Avatar
    Join Date
    Aug 2009
    Posts
    194
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Parent- & Sub-Category Dropdown Menus

    What would be really perfect is instead of a series of dropdown boxes, if it could be breadcrumb navigation like the front page, but I don't guess that's possible.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)