Support

Account

Home Forums Add-ons Repeater Field Repeater selection by category id

Unread

Repeater selection by category id

  • Hi.
    I need your help.

    There is a repeater that contains categories and a repeater with a list of indicators (enter manually).
    Первое

    There is a page on which all these data are filled and such a table is obtained.
    two

    On each page of records a repeater with a list of indicators (which were entered on the page above) and a mark (false / true) is displayed.

    three

    How can you make it so that the indicators are tightened depending on the category in which the record is located.

    I’m doing this way. In the function.php file

    function acf_load_select_pokaz( $field ) {

    $field[‘choices’] = array();
    if( have_rows(‘f_pokaz’, 47) ) {
    while( have_rows(‘f_pokaz’, 47) ) {
    the_row();
    $terms = get_the_terms( get_the_ID(), ‘category’);
    $termname = get_sub_field(‘f_pokaz_cat’, $terms);
    if( have_rows(‘f_pokaz_blocktext’) ){
    while( have_rows(‘f_pokaz_blocktext’) ) {
    the_row();
    $value = get_sub_field(‘f_pokaz_text’);
    $field[‘choices’][$value] = $value;
    }
    }

    }

    }
    return $field;
    }

    add_filter(‘acf/load_field/name=function_item_name’, ‘acf_load_select_pokaz’);

    But it is not possible to select exactly the category in which this entry is found

Viewing 1 post (of 1 total)

The topic ‘Repeater selection by category id’ is closed to new replies.