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.
<?php
$args = array(
'posts_per_page' => 1,
'post_type' => 'profiles',
'orderby' => 'ID',
'order' => 'DSC');
'meta_name' ==> 'year', //not working
'meta_value' ==> '2015', //not working
query_posts($args);
?>
<?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; ?>
</section>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
Cheers!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.