Support

Account

Home Forums Backend Issues (wp-admin) Relationship field: Filter text…..

Helping

Relationship field: Filter text…..

  • i tried to change the filter text with some hints here in the forum but it did not work – my new appproch and working solution is this is:

    		$('select[data-filter="taxonomy"]').each(function() {
    			$(this)[0][0].text = acf.__('taxonomyfilter'); // allows me to translate the text in php
    		});

    Perhaps there exist a better solution it would be great – BUT another question…..

    Why it would not be possible from ACF to adjust the field source:

    			// vars
    			$post_type = acf_get_array( $field['post_type'] );
    			$taxonomy  = acf_get_array( $field['taxonomy'] );
    			$filters   = acf_get_array( $field['filters'] );
    
    			// filters
    			$filter_count             = count( $filters );
    			$filter_post_type_choices = array();
    			$filter_taxonomy_choices  = array();
    
    			// post_type filter
    			if ( in_array( 'post_type', $filters ) ) {
    
    				$filter_post_type_choices = array(
    					'' => __( 'Select post type', 'acf' ),
    				) + acf_get_pretty_post_types( $post_type );
    			}
    
    			// taxonomy filter
    			if ( in_array( 'taxonomy', $filters ) ) {
    
    				$term_choices            = array();
    				$filter_taxonomy_choices = array(
    					'' => __( 'Select taxonomy', 'acf' ),
    				);

    By adding:

    $filtertext = acf_get_array( $field['filtertext'] ); and some if checks..

    it would be possible to define the text in PHP and get a more quick solution than to change with jquery. In my project i have some pages with more than 10 relationship fields in a repeater and the “look and feel” is not so nice.

  • I don’t really know from your description what you’re trying to do. If this is a feature request then you would need to submit it to the developers either by contacting them or opening a ticket in your account.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.