Skip to content

Instantly share code, notes, and snippets.

@BiancaNL
Created October 30, 2017 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BiancaNL/545e09c7b8fa6deebcaf32173f962863 to your computer and use it in GitHub Desktop.
Save BiancaNL/545e09c7b8fa6deebcaf32173f962863 to your computer and use it in GitHub Desktop.
function acf_pricing_table() {
ob_start();
?>
<?php if( have_rows('pricing_table') ): ?>
<div class="pricing-table-container">
<?php while( have_rows('pricing_table') ): the_row();
$price = get_sub_field('price');
$description = get_sub_field('description');
$features = get_sub_field('features');
$btntxt = get_sub_field('button_text');
$btnlink = get_sub_field('button_link');
?>
<div class="acf-pricing-table">
<div class="acf-pricing-table-price"> <?php echo $price ?> </div>
<div class="acf-pricing-table-price-desc"> <?php echo $description ?> </div>
<?php if( have_rows('features') ): ?>
<div class="acf-pricing-table-features">
<ul>
<?php while( have_rows('features') ): the_row();
$feature = get_sub_field('feature');
?>
<li class="acf-pricing-table-feature"> <?php echo $feature ?> </li>
<?php endwhile; ?>
</ul>
</div>
<?php endif; ?>
<a class="acf-pricing-table-button" href=" <?php echo $btnlink ?>" title="<?php echo $description ?> <?php echo $btntxt ?>"> <?php echo $btntxt ?></a>
</div&gt
<?php endwhile; ?>
</div>
<?php endif; ?>
<?php
return ob_get_clean();
}
add_shortcode( 'acf-pricing-table',' acf_pricing_table' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment