A pretty specific problem.
I’m using the menu-walker to create a sub-menu, on one of the pages I wish to use an ACF-Field from all the posts with a specific category and put it into the menu. The Else
This is my menu walker custom-code, the esle-part works fine, the if gallery.php
doesn’t give an error, only the query_posts-loop doesn’t render anything.
if ( is_page_template( 'gallery.php' ) ) {
query_posts('category_name=produktion');
if (have_posts()) : while (have_posts()) : the_post();
$output .='
<li class="prodSub"><a href="#">'. get_field('prod_ens') .'</a></li>
';
endwhile;
endif;
} else {
// Returns false when 'about.php' is not being used.
if (get_field('info_block')): $count = 0;
while (has_sub_field('info_block')): $count++;
$output .='<li><a href="#infoBlock'. $count .'">' . get_sub_field('info_block_header') . '</a></li>';
endwhile;
endif;
if (get_field('ctc')): $count = 0;
while (has_sub_field('ctc')): $count++;
$output .='<li><a href="#ctcItem'. $count .'">' . get_sub_field('ctc_name') . '</a></li>';
endwhile;
endif;
}
$output .= '</ul>';