• Resolved Giellemme

    (@giellemme)


    I have created a Custom Post Type and some Custom Taxonomies and now I’m using Gravity Forms to let users add some entries. I can add to my form a dropdown select box and populate it with values from a custom taxonomy, which is fine, but I would like to have a select which lists only the main (parent) taxonomy values and then a couple of conditional select boxes, each listing the child values of a previously selected parent taxonomy.

    I mean:

    First select – Parent Taxonomy 1, Parent Taxonomy 2, Parent Taxonomy 3

    If user selects Parent Taxonomy 1 from first select: Show Second Select – Child (of Parent 1) Taxonomy 1, Child Taxonomy 2, Child Taxonomy 3

    ELSE

    If user selects Parent Taxonomy 2 from first select: Show third Select – Child (of Parent 2)Taxonomy 3, Child Taxonomy 4, Child Taxonomy 5

    ELSE

    If user selects Parent Taxonomy 3 from first select: Show fourth Select – Child (of Parent 3) Taxonomy 6, Child Taxonomy 7, Child Taxonomy 8

    Is this possible in any way?

    Thanks for your help!

    P.S. In alternative: Can I have the select adding both parent taxonomy and child taxonomy?

    https://www.ads-software.com/plugins/gravity-forms-custom-post-types/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi,

    I’m trying to achieve the same but haven’t had much luck yet.

    Have you got any further?

    Thanks

    Hi,

    I need the same thing ??

    Work in progress, let you know what I found.

    Cheers,

    Plugin Author Dave from Gravity Wiz

    (@spivurno)

    I’ve written a solution for this for another user. It does not require the usage of this plugin; only this snippet:

    https://gist.github.com/spivurno/7c4df0129545c0629150

    Here is an overview of how the functionality works:

    Hi David,

    Thanks for posting your solution.

    Do you have any experience with WP Job Manager? I need to achieve the same with this plugin.

    Many thanks.

    Plugin Author Dave from Gravity Wiz

    (@spivurno)

    Hi mrsminkle, nope, never used it. If you present my solution to the plugin author, they might be able to provide a version that works for their plugin. ??

    Hi David

    It’s a free plugin (add-ons aren’t) so I doubt it. I’m looking for a good developer to be able to do this for me (paid). WP Job Manager doesn’t allow gravity forms to be used for its submission.

    HI David

    I’ve implemented your code on gitub, but after form submitting it registers the taxonomy value, not the name.have you a solution for this? thanks

    Thank you for posting this solution David.

    @sergcruc I put this into functions.php (change 1 to form id, $entryid to the field in your form and taxonomy to your taxonomy slug

    add_action( 'gform_after_submission_1', 'set_post_content', 10, 2 );
    function set_post_content( $entry, $form ) {
    	$post = get_post( $entry['post_id'] );
    	wp_set_post_terms( $post->ID, array(rgar( $entry, '123' )), 'taxonomy', false );
    }

    Thank you David for your awesome code. And also thank you Fredrik for your suggestion.

    This is almost exactly what I was looking for.

    Is there any way to do exactly this but populate the next child term in a new list?

    Something like:
    Field 1: Choose country: US / Canada / Mexico
    Field 2: Choose State: List of states in chosen country in field 1
    Field 3: Choose city: List of cities in chosen state in field 2

    Thanks in advance.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Conditional Dropdowns with Custom Taxonomies’ is closed to new replies.