Код: Выделить всё
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 для не-Logged Users и когда Show_only_to_logged_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 для условных? Вложенная в основной петлю повторяющего вкуса (haf_rows ('repeater')): the_row (); Подробнее здесь: https://stackoverflow.com/questions/794 ... ster-field
Мобильная версия