Advertisement
purevtsooj

Shortcode

Aug 18th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.09 KB | None | 0 0
  1. <?php
  2.  
  3. class WPBakeryShortCode_Tt_team_Slider extends WPBakeryShortCode {
  4.     protected function content( $atts, $content = null){
  5.         extract( shortcode_atts( array(
  6.             "layout" => 'standard',
  7.             "list" => "",
  8.             "extra_class" => ""
  9.         ), $atts ) );
  10.  
  11.  
  12.         $list = vc_param_group_parse_atts($list);
  13.         $lists = '';
  14.         $slider_bullets = "<div class='swiper-pagination'></div>";
  15.  
  16.         if( is_array($list) ){
  17.             foreach ($list as $item) {
  18.                 $image = isset($item['image']) ? $item['image'] : "";
  19.                
  20.                 $professional = isset($item['professional']) ? $item['professional'] : "";
  21.                 $professional = !empty($professional) ? "$professional" : "";
  22.  
  23.                 $name = isset($item['name']) ? $item['name'] : "";
  24.                 $name = !empty($name) ? "$name" : "";
  25.  
  26.                 $description_text = isset($item['description_text']) ? $item['description_text'] : "";
  27.                 $description_text = !empty($description_text) ? "$description_text" : "";
  28.                  
  29.                 $hover = isset($item['hover']) ? $item['hover'] : "";
  30.                 $hover = !empty($hover) ? "$hover" : "";
  31.  
  32.                 $socialz = isset($item['socialz']) ? $item['socialz'] : "";
  33.                 $socialz = !empty($socialz) ? "$socialz" : "";
  34.  
  35.  
  36.                 $atach_src = wp_get_attachment_image_src($image, 'large');
  37.                 $image = is_array($atach_src) ? $atach_src[0] : "";
  38.  
  39.                 $socialz_list='';
  40.                 $socialz_link = explode(',', $socialz);
  41.  
  42.  
  43.                 foreach($socialz_link as $socialz_link){
  44.  
  45.                     $see = explode("|", $socialz_link);
  46.                     $socialz_list.= $socialz_link.'<br>' ;  
  47.  
  48.                 }
  49.                 if($layout == 'style2'){
  50.                     $lists .="<div class='col-lg-4 col-lg-offset-0 col-md-4 col-md-offset-0 col-sm-6 col-sm-offset-3 col-xs-12'>
  51.                                <div class='team-block'>
  52.                                <img src='".esc_attr($image)."' alt='team image'>
  53.                                  <div class='later-team'>
  54.                                     <h4>$name</h4>
  55.                                       <h6>$professional</h6>
  56.                                            <div class='hiden-text'>
  57.                                              <p>$description_text</p>  
  58.                                                 <div class='team-share'>
  59.                                                    <a href='#' class='fa fa-facebook'></a>
  60.                                                    <a href='#' class='fa fa-twitter'></a>
  61.                                                    <a href='#' class='fa fa-pinterest'></a>
  62.                                                 </div>
  63.                                            </div>
  64.                                      </div>
  65.                                </div>
  66.                            </div>";
  67.                 }elseif ($layout== 'style3') {
  68.                     $lists.="<li class='team-member'>
  69.                                    <div class='img-wrap'>
  70.                                       <img src='".esc_attr($image)."' alt='team image'>
  71.                                        <div class='team-overlay'>
  72.                                            <p class='col-lg-12'>$hover</p>
  73.                                        </div>
  74.                                    </div>  
  75.                                    <div class='team-detail'>
  76.                                        <span class='tdesg'>$professional</span>
  77.                                        <span class='tname'>$name</span>
  78.                                        <ul class='tsocial'>
  79.                                            <li><a class='' href='#'><i class='fa fa-facebook'></i></a></li>
  80.                                            <li><a class='' href='#'><i class='fa fa-twitter'></i></a></li>
  81.                                            <li><a class='' href='#'><i class='fa fa-behance'></i></a></li>
  82.                                            
  83.                                        </ul>
  84.                                        <p>$description_text</p>
  85.                                    </div>
  86.                                </li>";
  87.                             }
  88.                 else{
  89.                     $lists .= "<div class='item team-item'>
  90.                                    <ul>
  91.                                        <li class='team-member'>
  92.                                            <div class='img-wrap'>
  93.                                                <img src='".esc_attr($image)."' alt='team image'>
  94.                                                <div class='team-overlay'>
  95.                                                    <p class='col-lg-12'>$hover</p>
  96.                                                </div>
  97.                                            </div>  
  98.                                            <div class='team-detail'>
  99.                                                <span class='tdesg'>$professional</span>
  100.                                                <span class='tname'>$name</span>
  101.                                                 <ul class='tsocial'>
  102.                                                    <li><a class='' href='#'><i class='fa fa-facebook'></i></a></li>
  103.                                                    <li><a class='' href='#'><i class='fa fa-twitter'></i></a></li>
  104.                                                </ul>
  105.                                                <p>$description_text</p>
  106.                                            </div>
  107.                                        </li>
  108.                                    </ul>
  109.                                </div>";
  110.                 }
  111.  
  112.                  
  113.                 }
  114.             }
  115.        
  116.         if($layout =='style2'){
  117.  
  118.             $result = $lists;
  119.  
  120.         }
  121.         elseif($layout =='style3'){
  122.  
  123.             $result ="<ul class='team-wrapper'>$lists</ul";
  124.  
  125.         }else{
  126.  
  127.             $result = "<div id='owl-demo'>
  128.                           $lists
  129.                        </div>";
  130.         }
  131.        
  132.  
  133.         return $result;
  134.     }
  135. }
  136.  
  137. vc_map( array(
  138.     "name" => esc_html__("Team Slider", 'dallas'),
  139.     "description" => esc_html__("Content slider", 'dallas'),
  140.     "base" => "tt_team_Slider",
  141.     "class" => "",
  142.     "icon" => "icon-wpb-quickload",
  143.     "category" => 'Dallas',
  144.     "show_settings_on_create" => true,
  145.     "params" => array(
  146.          array(
  147.             "type" => "dropdown",
  148.             "param_name" => "layout",
  149.             "heading" => esc_html__("Style", 'dallas'),
  150.             "value" => array(
  151.                 "Style 1" => "standard",
  152.                 "Style 2" => "style2",
  153.                 "Style 3" => "style3"
  154.             ),
  155.             "std" => "standard"
  156.         ),
  157.  
  158.         array(
  159.             'type' => 'param_group',
  160.             'heading' => esc_html__('Values', 'dallas'),
  161.             'param_name' => 'list',
  162.             'value' => '',
  163.             'params' => array(
  164.                 array(
  165.                     'type' => 'attach_image',
  166.                     "param_name" => "image",
  167.                     "heading" => esc_html__("Image", 'dallas')
  168.                 ),
  169.  
  170.                 // title text
  171.                 array(
  172.                     'type' => 'textfield',
  173.                     'heading' => esc_html__('Name', 'dallas'),
  174.                     'param_name' => 'name',
  175.                     'value' => 'Marene Grande'
  176.                 ),
  177.                 array(
  178.                     'type' => 'textfield',
  179.                     'heading' => esc_html__('Title hover text', 'dallas'),
  180.                     'param_name' => 'hover',
  181.                     'value' => 'I am very font of you because you are just my type.'
  182.                 ),
  183.                 array(
  184.                     'type' => 'textfield',
  185.                     'heading' => esc_html__('Professional name', 'dallas'),
  186.                     'param_name' => 'professional',
  187.                     'value' => 'Designer'
  188.                 ),
  189.                 array(
  190.                     'type' => 'textfield',
  191.                     'heading' => esc_html__('Description text', 'dallas'),
  192.                     'param_name' => 'description_text',
  193.                     'value' => 'this description'
  194.                 ),
  195.                 array(
  196.                     'type' => 'textfield',
  197.                     "param_name" => "socialz",
  198.                     "heading" => esc_html__("Social", 'dallas'),
  199.                     "value" => 'facbook|http//facebook.com,Twitter|http//facebook.com'
  200.                 )
  201.                
  202.             )
  203.         ),
  204.         array(
  205.             "type" => "textfield",
  206.             "param_name" => "extra_class",
  207.             "heading" => esc_html__("Extra Class", 'dallas'),
  208.             "value" => "",
  209.             "description" => esc_html__("If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.", 'dallas'),
  210.         )
  211.     )
  212. ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement