Guest User

Untitled

a guest
Feb 21st, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <?php if( have_rows('btn_row') ):
  2. echo '<div class="btn-row">';
  3. while ( have_rows('btn_row') ) : the_row();
  4. // IF ADD BUTTON OPTION
  5. $add_btn = get_sub_field('add_btn');
  6.  
  7. // BUTTON DETAILS
  8. $btn_txt = get_sub_field('btn_txt');
  9. $link_type = get_sub_field('link_type');
  10. $pagelink = get_sub_field('pagelink');
  11. $url = get_sub_field('url');
  12. $file = get_sub_field('file');
  13.  
  14. // LINK TYPE
  15. if($link_type == 'pagelink'):
  16. $link = $pagelink;
  17. $target = '_self';
  18. elseif($link_type == 'url'):
  19. $link = $url;
  20. $target = '_blank';
  21. elseif($link_type == 'file'):
  22. $link = $file['url'];
  23. $target = '_blank';
  24. endif;
  25.  
  26. // Add btn class before include on page
  27. echo '<div><a href="'.$link.'" class="'.$btn_class.'" target="'.$target.'">'.$btn_txt.'</a></div>';
  28.  
  29. endwhile;
  30. echo '</div>';
  31. endif; ?>
Add Comment
Please, Sign In to add comment