Question

I am trying to filter content depending on if a field has the value of 'copyclearance'. It is filtering but instead of showing the content with a value of 'copyclearance' it is hiding it and displaying the others. How do I alternate this so that it only displays the content with a value of 'copyclearance'.

<?php while(has_sub_field('team_profile')): 
        $category = get_sub_field('category');
        if($category!='copyclearance'){ ?>
        <li class="col-lg-3 teamProfile">
            <img src="<?php the_sub_field('user_image'); ?>" class="img-responsive"/>
            <h2><?php the_sub_field('profile_name'); ?></h2>
            <p class="jobTitle"><?php the_sub_field('category'); ?></p>
            <p><?php the_sub_field('bio'); ?></p>
        </li>
    <?php } 
    endwhile; ?>
Was it helpful?

Solution

Simply change

if($category!='copyclearance')

to

if($category=='copyclearance')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top