Support

Account

Forum Replies Created

  • Hi John,

    This is a bit hard to explain. However, I wanted to display all the course providers who has a true value(1) within the relationship. Instead I got all the course providers who has a true value(1) within and apart from the relationship. Sorted this out with a radio field by following code. (should be possible with TRUE/FALSE as well)

    <?php while ( have_posts() ) : the_post();
    
                $rto_providers = get_posts(array(
                  'post_type' => 'rto_providers',
                  'meta_query' => array(
                    array(
                      'key' => 'courses_offered',
                      'value' => '"' . get_the_ID() . '"',
                      'compare' => 'LIKE'
                    )
                  )
                ));
                ?>
    
                <?php if( $rto_providers ): ?>
                  <?php foreach( $rto_providers as $rto_provider ): ?>
                    <?php if( get_field('account_activation', $rto_provider->ID) == 'Active' ): ?>
                      <div class="row bordered-row random">
                        <div class="col-md-2 providers-list">
                          <?php echo get_the_post_thumbnail( $rto_provider->ID ); ?>
                        </div>
                        <div class="col-md-8">
                          <a href="<?php echo get_permalink( $rto_provider->ID ); ?>">
                            <?php echo get_the_title( $rto_provider->ID ); ?>
                          </a>
                        </div>
                        <div class="col-md-2">
                          <a href="<?php echo get_permalink( $rto_provider->ID ); ?>" class="btn btn-base">
                            Visit Page
                          </a>
                        </div>
                      </div>
                    <?php endif; ?>
                  <?php endforeach; ?>
                <?php endif; ?>
                
          <?php endwhile; ?>
Viewing 1 post (of 1 total)