• Resolved Ulrich

    (@grapplerulrich)


    In version 3.1 the filter gfcpt_taxonomy_args was added to allow modifying the arguments used to retrieve taxonomy terms.

    We would like to do the same for the taxonomy term choices in the backend.

    Would you consider replacing $terms = get_terms( $taxonomy, 'orderby=name&hide_empty=0' ); with the following code?

    $args = gf_apply_filters( 'gfcpt_taxonomy_args', array( $field->formId, $field->id ), array(
        'taxonomy'   => $taxonomy,
        'orderby'    => 'name',
        'hide_empty' => 0
    ), $field );
    $terms = get_terms($args);

    For the Post Type select box it would be useful to have the post type name in addition to the label. So replacing <?php echo $post_type->label; ?> with <?php echo $post_type->label . ' (' . $post_type->name . ')'; ?>.

    It would look something like this:

    Cheers
    Ulrich

    • This topic was modified 3 years, 4 months ago by Ulrich.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author claygriffiths

    (@claygriffiths)

    Hi Ulrich,

    Thanks so much for the great suggestions and code to go along with them!

    We implemented both suggestions and released them in 3.1.22.

    Thread Starter Ulrich

    (@grapplerulrich)

    Hey Clay, Thank you for adding them ??

    Thread Starter Ulrich

    (@grapplerulrich)

    The taxonomy name in the dropdown could also be useful. Sorry I forgot to mention that earlier.

    <?php echo $taxonomy->label . ' (' . $taxonomy->name . ')'; ?>

    Plugin Author claygriffiths

    (@claygriffiths)

    Good call! We’ll get that released in the next update that goes out.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add filter to filter taxonomy term choices’ is closed to new replies.