我觉得我离得很近,但我只需要有人帮助我完成这项工作。我使用了一个带有高级自定义字段的转发器字段,并使用了echo短代码,但只需要部分内容在循环中重复。
请参见下面的我的代码:
<?php
// check if the repeater field has rows of data
if( have_rows(\'homepage_slider\') ):
// loop through the rows of data
// display a sub field value
echo do_shortcode(\'
[ux_slider timer="4500" arrows="true" bullets="true" auto_slide="true" nav_color="light"]
\' . while ( have_rows(\'homepage_slider\') ) : the_row(); . \'
[ux_banner bg=" \' . get_sub_field(\'slider_image\') . \' " height="600px" text_color="light" text_align="center" text_pos="center" text_width="70%" parallax_text="0" parallax="3" effect="sparkle"]
<h1>\' . get_sub_field(\'slider_slide_title\') . \'</h1>
<h4 class="thin-font">\' . get_sub_field(\'slider_sub_title\') . \'</h4>
[/ux_banner]
\' . endwhile; . \'
[/ux_slider]\');
else :
// no rows found
endif;
?>
似乎是“while”和“endwhile”的位置,但ux\\U横幅是我想重复的唯一短代码。如何在echo do\\u短代码中使用“while”和“end while”?如果你有任何想法/想法,请告诉我,非常感谢你的帮助。