Skip to content

Instantly share code, notes, and snippets.

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 cyberwani/9089776 to your computer and use it in GitHub Desktop.
Save cyberwani/9089776 to your computer and use it in GitHub Desktop.
<?php
//shop page for add ons
function pmpro_addons_shortcode($atts, $content=null, $code="")
{
ob_start();
global $wpdb, $post, $current_user, $pmpro_currency_symbol;
?>
<div id="pmpro_addons">
<?php
$count = 0;
// get posts
query_posts(array("meta_key"=>"_pmproap_price", "meta_compare"=>"!=", "meta_value"=>"", "showposts"=>-1, "orderby"=>"menu_order", "order"=>"ASC"));
global $wp_query;
if ( have_posts() ) : while ( have_posts() ) : the_post();
$pmproap_price = get_post_meta($post->ID, "_pmproap_price", true);
if(empty($pmproap_price))
continue;
?>
<div class="pmpro_addon one_third<?php if($count % 3 == 2) { ?>_last<?php } ?>">
<h3><?php the_title(); ?></h3>
<h4><?php echo $pmpro_currency_symbol . $pmproap_price; ?></h4>
<a class="pmpro_btn" href="<?php echo pmpro_url("checkout", "?level=" . $text_level_id . "&ap=" . $post->ID); ?>">Buy Now</a>
</div> <!-- end pmpro_addon, one_third-->
<?php
$count++;
endwhile; endif; wp_reset_query();
?>
</div> <!-- end #pmpro_addons -->
<?php
$temp_content = ob_get_contents();
ob_end_clean();
return $temp_content;
}
add_shortcode("pmpro_addons", "pmpro_addons_shortcode");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment