Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if( have_rows('btn_row') ):
- echo '<div class="btn-row">';
- while ( have_rows('btn_row') ) : the_row();
- // IF ADD BUTTON OPTION
- $add_btn = get_sub_field('add_btn');
- // BUTTON DETAILS
- $btn_txt = get_sub_field('btn_txt');
- $link_type = get_sub_field('link_type');
- $pagelink = get_sub_field('pagelink');
- $url = get_sub_field('url');
- $file = get_sub_field('file');
- // LINK TYPE
- if($link_type == 'pagelink'):
- $link = $pagelink;
- $target = '_self';
- elseif($link_type == 'url'):
- $link = $url;
- $target = '_blank';
- elseif($link_type == 'file'):
- $link = $file['url'];
- $target = '_blank';
- endif;
- // Add btn class before include on page
- echo '<div><a href="'.$link.'" class="'.$btn_class.'" target="'.$target.'">'.$btn_txt.'</a></div>';
- endwhile;
- echo '</div>';
- endif; ?>
Add Comment
Please, Sign In to add comment