SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2013
    0 Post(s)
    0 Thread(s)

    Question [WordPress] Dynamic Dropdown lists for Categories, Sub-Categories, Posts!

    Greetings people!

    This is my first post for this forum so I would like to wish you all a Happy New Year!

    I'm using WordPress 3.5 as CMS to develop my personal website.

    The reason I'm writting, is that I need a way to implement a code or plugin to allow users to navigate through posts using dependent(chained) dropdown lists.

    In other words I would like 3 dropdown menus to be dynamically populated based on the selection chosen in the previous dropdown lists.

    This would consist of:

    Dropdown 1: Category *
    Dropdown 2: Sub- Category *
    Dropdown 3: List of posts in Sub-Category *

    *Dropdown 1 would be pre populated with categories.
    *Dropdown 2 would list the sub categories of menu 1 based on the user selection.
    *Dropdown 3 would list the posts in the sub category chosen in menu 2.

    To help you understand further, in my website I have the Category "TV Series" which has as sub-categories(child) other series, like "Dexter", "CSI:Miami" etc.
    Series also have other sub-categories(child) the number of seasons, like "Season 1" "Season 2" "Season N". Each season contains the appropriate posts.

    The Hierarchy is like this:

    Tv Series

    --Season 1
    --Season 2
    --Season n

    --Season 1
    --Season 2
    --Season n

    So for example the dynamic dropdowns I would like to use are the following:

    Dropdown 1: Select TV Show (Category)
    Dropdown 2: Select Season (sub-category)
    Dropdown 3: Select Episode (posts)

    I would really appreciate if you could help me with the matter as I was searching the web for the past few days without any results.

    Thanks in advance.

  2. #2
    SitePoint Zealot
    Join Date
    Jun 2011
    Kolding, Denmark
    6 Post(s)
    0 Thread(s)
    For the first dopdown you can use get_categories, for the second level use same function adding parent parameter to the arguments. If you don't want to deal with outputting html yourself, then wp_dropdown_categories might be more suitable.
    To get posts get_posts seems suitable with added category parameter to arguments array.

  3. #3
    SitePoint Mentor silver trophybronze trophy

    Join Date
    Feb 2008
    Preston, Lancashire
    72 Post(s)
    1 Thread(s)
    If you're not coding the theme, and it's pre-built, you can easily achieve all this with Gravity Forms; it's a premium plug-in but as mentioned by many, well worth your dollars.
    follow me on ayyelo, Easy WordPress; specializing in setting up themes!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts