Support

Account

Home Forums Front-end Issues Build a menu from from multiple custom posts Reply To: Build a menu from from multiple custom posts

  • Solution if anyone is look for it, managed to figure it out.

    <?php 
    
    	$args = array(													
    	'post_type' => 'product', 
    	'posts_per_page' => -1, 
    	'orderby' => 'title', 
    	'order' => 'ASC',
    	'meta_query' => array(
    	       array(
    	           'key' 		=>	'is_featured_product',
    	       )
    	    )
    	);
    ?>
    	
    <?php $loop = new WP_Query( $args ); ?>
    <div class="nav subnav">
    	<ul id="menu-top-ten-product-menu" class="menu">
    		<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    			<li>
    				<a href="<?php the_field('product_logo'); ?>">
    					<img src="<?php the_field('product_logo'); ?>" alt="">
    				</a>
    			</li>
    		<?php endwhile; ?>
    		<?php wp_reset_query(); ?>
    	</ul>
    </div>