Home Forums Add-ons Repeater Field If Subfields Equals, Show Posts Reply To: If Subfields Equals, Show Posts

  • Here’s my code to show where I’m stuck. Note that this is using one meta value and not more than one, which is what I’m looking for. This code doesn’t work. It ignores the meta name and value in the args array.

    	$args = array(
        'posts_per_page' => 1,
        'post_type' => 'profiles',
    	'orderby' => 'ID',
    	'order' => 'DSC');
    	'meta_name' ==> 'year', //not working
    	'meta_value' ==> '2015', //not working
    <?php while ( have_posts() ) : the_post(); ?>
    <section class="winner-level">
    	<h3><a>"><?php the_title(); ?></a></h3>
    	<?php if(get_field('awards_given')): ?>
      	<?php while(has_sub_field('awards_given')): ?>
    	<?php if( get_sub_field('year') ): ?>
    	<p><?php the_sub_field('program'); ?> - <?php the_sub_field('program_category'); ?></p>
    	<p><em><?php the_sub_field('campaign_title'); ?></em></p>
    	<p><strong><?php the_sub_field('level'); ?></strong></p>
    	<?php endif; ?>
    	<?php endwhile; ?>
     	<?php endif; ?>
    <?php endwhile; ?> 
    <?php wp_reset_query(); ?>