Код: Выделить всё
if (have_rows('repeater')):
echo '';
while( have_rows('repeater') ): the_row();
echo '';
echo '';
the_sub_field('title');
echo '';
endwhile;
echo '';
endif;
< /code>
и это выводит: < /p>
The title
Another title
// and on and on
Что у меня сейчас есть, код. Ниже отображается только строки с подполе Show_only_TO_LOGGED_IN_ADMINS в значении 1 для пользователей, которые являются введенными в систему администраторов, и он не отображает RWO для неигровых пользователей, и когда Show_only_TO_LOGGED_IN_ADMINS Полевое значение составляет 0. < /p>
.
Код: Выделить всё
if (have_rows('repeater')):
echo '';
while( have_rows('repeater') ): the_row();
$show_only = get_sub_field('show_only_to_logged_in_admins');
$current_user = wp_get_current_user();
if ((user_can( $current_user, 'administrator' )) & ($show_only == 1)) {
echo '';
echo '';
the_sub_field('title');
echo '';
}
endwhile;
echo '';
endif;
< /code>
Но мне нужно: < /p>
// the rows that are shown to logged users and when
// the repeater subfield show_only_to_logged_in_admins
// has the value of 1
The title
// and on and on
// and then the rest of the repeater rows
Another title
< /code>
Как я могу отобразить условные строки, а затем продолжить цикл для всех остальных строк? У-While Loop для условных? Вложенная инкодирование основной цикл ретранслятора while (haf_rows ('repeater')): the_row (); Подробнее здесь: https://stackoverflow.com/questions/794 ... ster-field
Мобильная версия