Guest User

Untitled

a guest
Dec 13th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. <?php global $wp_query;
  2. $page_id = $wp_query->post->ID;
  3. ?>
  4.  
  5. <?php
  6. // check if the repeater field has rows of data
  7. if( have_rows('company','option') ):
  8. // loop through the rows of data
  9. while ( have_rows('company', 'option') ) : the_row(); // display a sub field value
  10. $page = get_sub_field('applies_to', 'option');
  11. $company_tagline = get_sub_field('company_and_tagline','option');
  12. $contact = get_sub_field('contact','option');
  13. ?>
  14.  
  15.  
  16. <?php if( $page == $page_id ) : ?>
  17.  
  18. <div class="company-details-container">
  19.  
  20. <?php if( get_sub_field('company_and_tagline','option') ): ?>
  21. <div class="company-tagline">
  22. <?php echo $company_tagline; ?>
  23. &#64; <?php echo date('Y'); ?>
  24. </div>
  25. <?php endif; ?>
  26. <?php if( get_sub_field('contact','option') ): ?>
  27. <div class="company-contact">
  28. <span>Contact</span>
  29. <?php echo $contact; ?>
  30. </div>
  31. <?php endif; ?>
  32. <?php if( get_sub_field('social','option') ): ?>
  33. <div class="footer-social">
  34. <span>Connect</span>
  35. <ul>
  36. <?php
  37. // check if the repeater field has rows of data
  38. if( have_rows('social','option') ):
  39. // loop through the rows of data
  40. while ( have_rows('social', 'option') ) : the_row(); // display a sub field value
  41. $social_link = get_sub_field('social_link', 'option');
  42. $icon = get_sub_field('icon','option');
  43. ?>
  44.  
  45. <li><a href="<?php echo $social_link; ?>"><img class="icon" src="<?php echo $icon; ?>"></a></li>
  46.  
  47. <?php endwhile;
  48. else :
  49. // no rows found
  50. endif;
  51. ?>
  52. </ul>
  53. </div>
  54. <?php endif; ?>
  55.  
  56. </div>
  57.  
  58. <?php endif; ?>
  59.  
  60. <?php endwhile;
  61. else :
  62. // no rows found
  63. endif;
  64. ?>
  65.  
  66. <?php if(get_sub_field('applies_to', 'option')) { ?>
  67. <?php if( $page == $page_id ) : ?>
  68. <?php echo $page; ?>
  69. <?php endif; ?>
  70. <?php } else { ?>
  71. there is no page selected
  72. <?php } ?>
Add Comment
Please, Sign In to add comment