Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //- Pricing Tables -------*/
- function pricing_tables_shortcode($atts, $content = null) {
- extract( shortcode_atts(
- array(
- 'columns' => 'four',
- 'slug' => ''
- ), $atts ) );
- //get column count and set post count
- if($columns == 'four') { $pricing_tables_count = '4'; } else { $pricing_tables_count = '3'; }
- //set loop arguments
- $post_args = array(
- 'post_type' => 'pricing_tables',
- 'pricing_tables_cats' => ''. $slug.'',
- 'posts_per_page' => $pricing_tables_count,
- 'order'=> 'DESC',
- );
- //get pricing table posts
- $pricing_tables = get_posts($post_args);
- //Start Content
- $content .= '<div class="pricing-table-wrap clearfix">';
- //start counter and loop
- $count=0;
- foreach ($pricing_tables as $pricing_table) {
- $count++;
- //get pricing tables meta
- $pricing_tables_featured = get_post_meta($pricing_table->ID, 'classy_pricing_tables_featured', TRUE);
- $pricing_tables_price = get_post_meta($pricing_table->ID, 'classy_pricing_tables_price', TRUE);
- $pricing_tables_money_symbol = get_post_meta($pricing_table->ID, 'classy_pricing_tables_money_symbol', TRUE);
- $pricing_tables_rate = get_post_meta($pricing_table->ID, 'classy_pricing_tables_rate', TRUE);
- $pricing_tables_url = get_post_meta($pricing_table->ID, 'classy_pricing_tables_url', TRUE);
- $pricing_tables_btn_text = get_post_meta($pricing_table->ID, 'classy_pricing_tables_btn_text', TRUE);
- //set variable for gs grid
- if($columns == 'four') { $pricing_grid = 'grid_6'; } else { $pricing_grid = 'grid_8'; }
- //set variable for alpha and omegas
- if($count==1){ $class = 'alpha'; }
- if($count==2){ $class = ''; }
- if($count==$pricing_tables_count) { $class = 'omega'; }
- //see if pricing table is featured, if so set variable class
- if($pricing_tables_featured == 'Yes') { $featured = 'featured'; } else { $featured =''; }
- $content .= '<div class="'. $pricing_grid . ' '. $class .'">';
- $content .= '<div class="pricing-table '.$featured.' clearfix">';
- if($featured !='') {
- $content .= '<span class="pricing-popular-tag"></span>';
- }
- $content .='<div class="pricing-table-header">';
- $content .= '<h3>'. get_the_title($pricing_table->ID, 'testimonial') .'</h3>';
- $content .= '<div class="price"><span class="symbol">'. $pricing_tables_money_symbol .'</span>'. $pricing_tables_price .'<span class="rate">'.$pricing_tables_rate.'</span></div>';
- $content .= '</div>';
- $content .= wptexturize($pricing_table->post_content);
- if($pricing_tables_url !='') {
- $content .= '<div class="pricing-table-button"><a href="'.$pricing_tables_url.'" title="'.$pricing_tables_btn_text.'">'.$pricing_tables_btn_text.'</a></div>';
- }
- $content .= '</div>';
- $content .='<span class="pricing-shadow-'.$columns.'"></span>';
- $content .= '</div>';
- //reset count
- if($count == $pricing_tables_count ) { $count=0; }
- }
- $content .= '</div>';
- return $content;
- }
- add_shortcode('pricing_table_shortcode', 'pricing_tables_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement