1
foreach 루프 내에서 카운트를 에코 할 수 있습니까? 나는 메뉴 버튼 1, 메뉴 버튼이 그래서 아래의 DIV의 클래스를 변경할 등 등 :foreach 루프 내에서 에코 카운트 아웃
<?php
$pages = get_children(array('orderby' => 'menu_order', 'order' => 'asc'));
foreach($pages as $post) {
setup_postdata($post);
$fields = get_fields();
?>
<div class="menu-button-(insert counter here)">
<a href="<?php echo get_page_link($post->ID); ?>"><?php echo $post->post_title; ?></a>
</div>
<?php
}
wp_reset_query();
?>
그래서 나는이 같은 출력 뭔가 원하는 - <div class="menu-button-1">
다음 <div class="menu-button-2">
등 각 루프를 통과하는 시간.