Advertisement
was955

Altair WordPress for Travel

Sep 10th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.23 KB | None | 0 0
  1.  
  2. function ppb_tour_grid_func_razztech($atts, $content) {
  3.  
  4.     //extract short code attr
  5.     extract(shortcode_atts(array(
  6.         'size' => 'one',
  7.         'title' => '',
  8.         'items' => 30,
  9.         'tourcat' => '',
  10.         'order' => 'default',
  11.         'custom_css' => '',
  12.         'layout' => 'fullwidth',
  13.     ), $atts));
  14.    
  15.     if(!is_numeric($items))
  16.     {
  17.         $items = 30;
  18.     }
  19.    
  20.     $return_html = '<div class="ppb_tour '.$size.' withpadding ';
  21.    
  22.     $columns_class = 'three_cols';
  23.     if($layout=='fullwidth')
  24.     {
  25.         $columns_class.= ' fullwidth';
  26.     }
  27.     $element_class = 'one_third gallery3';
  28.     $tour_h = 'h5';
  29.    
  30.     if(empty($content) && empty($title))
  31.     {
  32.         $return_html.='nopadding ';
  33.     }
  34.    
  35.     $return_html.= '" ';
  36.    
  37.     if(!empty($custom_css))
  38.     {
  39.         $return_html.= 'style="'.urldecode($custom_css).'" ';
  40.     }
  41.    
  42.     $return_html.= '>';
  43.    
  44.     $return_html.='<div class="page_content_wrapper ';
  45.    
  46.     if($layout == 'fullwidth')
  47.     {
  48.         $return_html.='full_width';
  49.     }
  50.    
  51.     $return_html.= '" style="text-align:center">';
  52.  
  53.     //Display Title
  54.     if(!empty($title))
  55.     {
  56.         $return_html.= '<h2 class="ppb_title">'.$title.'</h2>';
  57.     }
  58.    
  59.     //Display Content
  60.     if(!empty($content) && !empty($title))
  61.     {
  62.         $return_html.= '<div class="page_caption_desc">'.$content.'</div>';
  63.     }
  64.    
  65.     //Display Horizontal Line
  66.     if(empty($content) && !empty($title))
  67.     {
  68.         $return_html.= '<br/>';
  69.     }
  70.    
  71.     $tour_order = 'ASC';
  72.     $tour_order_by = 'menu_order';
  73.     switch($order)
  74.     {
  75.         case 'default':
  76.             $tour_order = 'ASC';
  77.             $tour_order_by = 'menu_order';
  78.         break;
  79.        
  80.         case 'newest':
  81.             $tour_order = 'DESC';
  82.             $tour_order_by = 'post_date';
  83.         break;
  84.        
  85.         case 'oldest':
  86.             $tour_order = 'ASC';
  87.             $tour_order_by = 'post_date';
  88.         break;
  89.        
  90.         case 'title':
  91.             $tour_order = 'ASC';
  92.             $tour_order_by = 'title';
  93.         break;
  94.        
  95.         case 'random':
  96.             $tour_order = 'ASC';
  97.             $tour_order_by = 'rand';
  98.         break;
  99.     }
  100.    
  101.     //Get tour items
  102.     $args = array(
  103.         'numberposts' => $items,
  104.         'order' => $tour_order,
  105.         'orderby' => $tour_order_by,
  106.        
  107.         'post_type' => array('tours'),
  108.         'tax_query' => array(
  109.                 array(
  110.                     'taxonomy' => 'tourcats',  
  111.                     'exclude'          => '34,35,36',                  
  112.                      'include_children' => false
  113.                 )
  114.             ),
  115.      
  116.         'suppress_filters' => 0,
  117.     );
  118.    
  119.     if(!empty($tourcat))
  120.     {
  121.         $args['tourcats'] = $tourcat;
  122.     }
  123.     $tours_arr = get_posts($args);
  124.  
  125. /********************/ 
  126.  
  127.      
  128.      ?>
  129.  
  130.    
  131.         <div class="portfolio_filter_wrapper three_cols fullwidth shortcode gallery section content clearfix">
  132. <?php
  133.    
  134.         foreach(get_terms('tourcats') as $cat)
  135.         {
  136.                    
  137.             //Begin display HTML
  138.             ?>
  139.         <div class="element portfolio3filter_wrapper">
  140.             <div class="<?php echo $element_class; ?> filterable gallery_type animated1">      
  141.            
  142.                 <a href='<?php echo get_term_link($cat->slug, 'tourcats'); ?>'>
  143.                     <img src="<?php echo z_taxonomy_image_url($cat->term_id,'gallery_grid'); ?> " alt="" />
  144.                 </a>
  145.            
  146.            
  147.                 <div class="thumb_content fullwidth">
  148.                     <div class="thumb_title" style="width: 100%;">
  149.                        
  150.                             <h3><?php echo $cat->name; ?></h3>
  151.                        
  152.                     </div>
  153.                 </div>
  154.             </div>
  155.         </div>
  156.         <?php  } ?>
  157.        
  158.        
  159.    
  160.    
  161.         </div>
  162.     </div>
  163.     </div>
  164.    
  165.  
  166.     <?php
  167.  
  168.     return $return_html;
  169.     }
  170.  
  171. add_shortcode('ppb_tour_grid_razztech', 'ppb_tour_grid_func_razztech');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement