Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php global $wp_query;
- $page_id = $wp_query->post->ID;
- ?>
- <?php
- // check if the repeater field has rows of data
- if( have_rows('company','option') ):
- // loop through the rows of data
- while ( have_rows('company', 'option') ) : the_row(); // display a sub field value
- $page = get_sub_field('applies_to', 'option');
- $company_tagline = get_sub_field('company_and_tagline','option');
- $contact = get_sub_field('contact','option');
- ?>
- <?php if( $page == $page_id ) : ?>
- <div class="company-details-container">
- <?php if( get_sub_field('company_and_tagline','option') ): ?>
- <div class="company-tagline">
- <?php echo $company_tagline; ?>
- @ <?php echo date('Y'); ?>
- </div>
- <?php endif; ?>
- <?php if( get_sub_field('contact','option') ): ?>
- <div class="company-contact">
- <span>Contact</span>
- <?php echo $contact; ?>
- </div>
- <?php endif; ?>
- <?php if( get_sub_field('social','option') ): ?>
- <div class="footer-social">
- <span>Connect</span>
- <ul>
- <?php
- // check if the repeater field has rows of data
- if( have_rows('social','option') ):
- // loop through the rows of data
- while ( have_rows('social', 'option') ) : the_row(); // display a sub field value
- $social_link = get_sub_field('social_link', 'option');
- $icon = get_sub_field('icon','option');
- ?>
- <li><a href="<?php echo $social_link; ?>"><img class="icon" src="<?php echo $icon; ?>"></a></li>
- <?php endwhile;
- else :
- // no rows found
- endif;
- ?>
- </ul>
- </div>
- <?php endif; ?>
- </div>
- <?php endif; ?>
- <?php endwhile;
- else :
- // no rows found
- endif;
- ?>
- <?php if(get_sub_field('applies_to', 'option')) { ?>
- <?php if( $page == $page_id ) : ?>
- <?php echo $page; ?>
- <?php endif; ?>
- <?php } else { ?>
- there is no page selected
- <?php } ?>
Add Comment
Please, Sign In to add comment