Wordpress: get ACF field from post category in menu walker

Specific problem. I am using the menu-walker to create a submenu, on one of the pages that I want to use ACF-Field, from all messages with a specific category and place them in the menu. Everything Else This is my custom walking menu code, esle-part works fine, if gallery.php

does not give an error, only the query_posts loop does not display 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>';

      

+3


source to share





All Articles