Advertisement
deliciousthemes

Shortcodes

Dec 16th, 2013
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 38.34 KB | None | 0 0
  1. <?php
  2. /*-----------------------------------------------------------------------------------*/
  3. /*  Buttons
  4. /*-----------------------------------------------------------------------------------*/
  5.  
  6. function button_shortcode( $atts, $content = null ) {
  7.     extract( shortcode_atts( array(
  8.       'color' => 'white',
  9.       'text' => '',
  10.       'size' => 'medium',
  11.       'url' => '',
  12.       ), $atts ) );
  13.        
  14.     if($url) {
  15.       return '<a class="button ' . $color .' '. $size . '" href="' . $url . '">' . $text . $content . '</a>';
  16.     } else {
  17.         return '<a class="button ' . $color . '" href="">' . $text . $content . '</a>';
  18.     }
  19. }
  20.  
  21. add_shortcode('button', 'button_shortcode');
  22.  
  23.  
  24.  
  25.  
  26. /*-----------------------------------------------------------------------------------*/
  27. /*  Countdown
  28. /*-----------------------------------------------------------------------------------*/
  29.  
  30. function countdown_shortcode( $atts, $content = null ) {
  31.     extract( shortcode_atts( array(
  32.         'time' => 'January 1, 2014 00:00:00'
  33.     ), $atts ) );
  34.    
  35.     wp_enqueue_script('countdown', get_template_directory_uri() . '/js/jquery.countdown.js', array('jquery'), '1.6.3', false );
  36.     wp_enqueue_script('custom-countdown', get_template_directory_uri() . '/js/custom-countdown.js', array('countdown'), '1.0', false );
  37.    
  38.        
  39.     //setting a random id
  40.     $random_id_length = 3;
  41.     $rnd_id = crypt(uniqid(rand(),1));
  42.     $rnd_id = strip_tags(stripslashes($rnd_id));
  43.     $rnd_id = str_replace(".","",$rnd_id);
  44.     $rnd_id = strrev(str_replace("/","",$rnd_id));
  45.     $rnd_id = str_replace(range(0,9),"",$rnd_id);
  46.     $rnd_id = substr($rnd_id,0,$random_id_length);
  47.     $rnd_id = strtolower($rnd_id);  
  48.    
  49.     $countdown_array = array( 'id' => $rnd_id, 'time' => $time );
  50.     wp_localize_script( 'custom-countdown', 'dt_countdown', $countdown_array );
  51.    
  52.     return '<div id="'.$rnd_id.'"></div>';
  53.  
  54. }
  55.  
  56. add_shortcode( 'countdown', 'countdown_shortcode' );
  57.  
  58.  
  59.  
  60. /*-----------------------------------------------------------------------------------*/
  61. /*  Clear
  62. /*-----------------------------------------------------------------------------------*/
  63.  
  64. function clear_shortcode() {
  65.    return '<div class="clear"></div>';
  66. }
  67.  
  68. add_shortcode( 'clear', 'clear_shortcode' );
  69.  
  70.  
  71.  
  72. /*-----------------------------------------------------------------------------------*/
  73. /*  Separator
  74. /*-----------------------------------------------------------------------------------*/
  75.  
  76. function separator_shortcode() {
  77.    return '<div class="separator"></div>';
  78. }
  79.  
  80. add_shortcode( 'separator', 'separator_shortcode' );
  81.  
  82.  
  83.  
  84. /*-----------------------------------------------------------------------------------*/
  85. /*  Space
  86. /*-----------------------------------------------------------------------------------*/
  87.  
  88. function space_shortcode( $atts, $content = null ) {
  89.     extract( shortcode_atts( array(
  90.         'height' => '60'
  91.     ), $atts ) );
  92.    return '<div style="clear:both; width:100%; height:'.$height.'px"></div>';
  93. }
  94.  
  95. add_shortcode( 'space', 'space_shortcode' );
  96.  
  97.  
  98.  
  99. /*-----------------------------------------------------------------------------------*/
  100. /*  Line Break
  101. /*-----------------------------------------------------------------------------------*/
  102.  
  103. function line_break_shortcode() {
  104.     return '<br />';
  105. }
  106. add_shortcode( 'br', 'line_break_shortcode' );
  107.  
  108.  
  109.  
  110. /*-----------------------------------------------------------------------------------*/
  111. /*  Lists
  112. /*-----------------------------------------------------------------------------------*/
  113.  
  114. function list_shortcode( $atts, $content = null )
  115. {
  116.     extract( shortcode_atts( array(
  117.         'icon' => 'ok'
  118.     ), $atts ) );
  119.    
  120.     return '<div class="customlist list-icon-'.$icon.'">'.do_shortcode($content).'</div>';
  121. }
  122.  
  123. add_shortcode('list', 'list_shortcode');
  124.  
  125.  
  126.  
  127. /*-----------------------------------------------------------------------------------*/
  128. /*  Taglines
  129. /*-----------------------------------------------------------------------------------*/
  130.  
  131. function tagline_shortcode( $atts, $content = null ) {
  132.     extract( shortcode_atts( array(
  133.         'title' => ''
  134.     ), $atts ) );
  135.      
  136.     return '<section class="intro"><h2>' . $title .'</h2><h5>'. $content .'</h5></section>';
  137. }
  138.  
  139. add_shortcode('tagline', 'tagline_shortcode');
  140.  
  141.  
  142.  
  143. /*-----------------------------------------------------------------------------------*/
  144. /*  Dropcaps
  145. /*-----------------------------------------------------------------------------------*/
  146.  
  147. function dropcap_shortcode( $atts, $content = null ) {
  148.     extract( shortcode_atts( array(
  149.         'style' => '1',
  150.         'text' => ''
  151.     ), $atts ) );
  152.      
  153.     return '<span class="dropcap' . $style . '">' . $text . $content .'</span>';
  154. }
  155.  
  156. add_shortcode('dropcap', 'dropcap_shortcode');
  157.  
  158.  
  159.  
  160. /*-----------------------------------------------------------------------------------*/
  161. /*  Highlighted text
  162. /*-----------------------------------------------------------------------------------*/
  163.  
  164. function highlighted_shortcode( $atts, $content = null ) {
  165.     extract( shortcode_atts( array(
  166.         'color' => 'dark',
  167.         'text' => ''
  168.     ), $atts ) );
  169.      
  170.     return '<span class="highlight ' . $color . '">' . $text . $content .'</span>';
  171. }
  172.  
  173. add_shortcode('highlighted', 'highlighted_shortcode');
  174.  
  175.  
  176.  
  177. /*-----------------------------------------------------------------------------------*/
  178. /*  Social Share Blog
  179. /*-----------------------------------------------------------------------------------*/
  180.  
  181. function social_shortcode( $atts, $content = null ) {
  182.     extract( shortcode_atts( array(
  183.         'title' => ''
  184.     ), $atts ) );
  185.      
  186.     $output = '';
  187.    
  188.     $output .= '<div class="share-options">';
  189.         if(!empty($title)) { $output .= '<h6>'.$title.'</h6>'; }
  190.         $output .= '<a href="" class="twitter-sharer" onClick="twitterSharer()"><i class="fa fa-twitter"></i></a>';
  191.         $output .= '<a href="" class="facebook-sharer" onClick="facebookSharer()"><i class="fa fa-facebook"></i></a>';
  192.         $output .= '<a href="" class="pinterest-sharer" onClick="pinterestSharer()"><i class="fa fa-pinterest"></i></a>';
  193.         $output .= '<a href="" class="google-sharer" onClick="googleSharer()"><i class="fa fa-google-plus"></i></a>';
  194.         $output .= '<a href="" class="delicious-sharer" onClick="deliciousSharer()"><i class="fa fa-share"></i></a>';
  195.         $output .= '<a href="" class="linkedin-sharer" onClick="linkedinSharer()"><i class="fa fa-linkedin"></i></a>';
  196.     $output .= '</div>';
  197.     $output .= '<p></p>';
  198.    
  199.     return $output;
  200. }
  201.  
  202. add_shortcode('social-block', 'social_shortcode');
  203.  
  204.  
  205.  
  206. /*-----------------------------------------------------------------------------------*/
  207. /*  Cycle Carousel
  208. /*-----------------------------------------------------------------------------------*/
  209.  
  210. function dt_cycle_carousel( $atts, $content = null ) {
  211.     extract( shortcode_atts( array(
  212.         'slidetime' => 10000
  213.     ), $atts ) );
  214.    
  215.     //setting a random id
  216.     $random_id_length = 3;
  217.     $rnd_id = crypt(uniqid(rand(),1));
  218.     $rnd_id = strip_tags(stripslashes($rnd_id));
  219.     $rnd_id = str_replace(".","",$rnd_id);
  220.     $rnd_id = strrev(str_replace("/","",$rnd_id));
  221.     $rnd_id = str_replace(range(0,9),"",$rnd_id);
  222.     $rnd_id = substr($rnd_id,0,$random_id_length);
  223.     $rnd_id = strtolower($rnd_id);  
  224.  
  225.     wp_enqueue_script('cycle');
  226.     $token = wp_generate_password(5, false, false);
  227.     wp_enqueue_script('custom-cycle', get_template_directory_uri() . '/js/custom-cycle.js', array('jquery'), '1.0', false );   
  228.     wp_localize_script( 'custom-cycle', 'dt_cycle_' . $token, array( 'id' => $rnd_id, 'slidetime' => $slidetime) );
  229.  
  230.    
  231.     $output ='';
  232.                
  233.     $output .= '<div class="del_cycle" id="cycle_'.$rnd_id.'" data-token="' . $token .'">'.do_shortcode($content).'</div>';
  234.     return $output;
  235. }
  236.  
  237. add_shortcode( 'cycle-carousel', 'dt_cycle_carousel' );
  238.  
  239.  
  240.  
  241. /*-----------------------------------------------------------------------------------*/
  242. /*  Contact Form Wrapper
  243. /*-----------------------------------------------------------------------------------*/
  244.  
  245. function contact_wrapper_shortcode( $atts, $content = null ) {
  246.     extract( shortcode_atts( array(
  247.         'class' => ''
  248.     ), $atts ) );
  249.      
  250.     return '<div id="contactform '.$class.'">'.do_shortcode($content).'</div>';
  251. }
  252.  
  253. add_shortcode('form-wrapper', 'contact_wrapper_shortcode');
  254.  
  255.  
  256.  
  257. /*-----------------------------------------------------------------------------------*/
  258. /*  Columns
  259. /*-----------------------------------------------------------------------------------*/
  260.  
  261. function column_shortcode( $atts, $content = null ) {
  262.     extract( shortcode_atts( array(
  263.         'size' => 'one-half',
  264.         'text' => '',
  265.         'position' => ''
  266.     ), $atts ) );
  267.  
  268.     if(!empty($position)) {
  269.         return '<div class="percent-' . $size . ' column-' . $position . '"> '.do_shortcode($content).'</div>';
  270.     } else {
  271.         return '<div class="percent-' . $size . '"> ' .do_shortcode($content). '</div>';
  272.     }
  273. }
  274.  
  275. add_shortcode('column', 'column_shortcode');
  276.  
  277.  
  278.  
  279. /*-----------------------------------------------------------------------------------*/
  280. /*  Pricing Table
  281. /*-----------------------------------------------------------------------------------*/
  282.  
  283. //pricing table placebo
  284.  
  285. function pricing_table_placebo( $atts, $content = null ) {
  286.     return do_shortcode($content);
  287. }
  288. add_shortcode( 'table_placebo', 'pricing_table_placebo' );
  289.  
  290.  
  291. // body
  292. function delicious_pricing_table( $atts, $content = null ) {
  293.     global $dt_table;
  294.     extract(shortcode_atts(array(
  295.         'columns' => '4'
  296.     ), $atts));
  297.    
  298.     $columnsNr = '';
  299.     $finished_table = '';
  300.  
  301.     switch ($columns) {
  302.         case '2':
  303.             $columnsNr .= 'table-2';
  304.             break;
  305.         case '3':
  306.             $columnsNr .= 'table-3';
  307.             break;
  308.         case '4':
  309.             $columnsNr .= 'table-4';
  310.             break;
  311.         case '5':
  312.             $columnsNr .= 'table-5';
  313.             break;
  314.         case '6':
  315.             $columnsNr .= 'table-6';
  316.             break;
  317.     }
  318.  
  319.     do_shortcode($content);
  320.  
  321.     $columnContent = '';
  322.     if (is_array($dt_table)) {
  323.  
  324.         for ($i = 0; $i < count($dt_table); $i++) {
  325.             $columnClass = 'pricing-column'; $n = $i + 1;
  326.             $columnClass .= ( $n % 2 ) ?  '' : ' even-column';
  327.             $columnClass .= ( $dt_table[$i]['featured'] ) ?  ' featured-column' : '';
  328.             $columnClass .= ( $n == count($dt_table) ) ?  ' last-column' : '';
  329.             $columnClass .= ( $n == 1 ) ?  ' first-column' : '';
  330.             $columnContent .= '<div class="'.$columnClass.' '.$columnsNr.'">';
  331.             $columnContent .= '<div class="pricing-header">';
  332.             if (( $dt_table[$i]['featured'] ) == '1' ) {
  333.                 $columnContent .= '<div class="column-shadow"></div>';
  334.             }          
  335.             $columnContent .='<div class="package-title">'.$dt_table[$i]['title'].'</div><div class="package-value"><span class="package-currency">'.$dt_table[$i]['currency'].'</span><span class="package-price">'.$dt_table[$i]['price'].'</span><span class="package-time">'.$dt_table[$i]['interval'].'</span></div></div>';
  336.             $columnContent .= '<ul class="package-features">'.str_replace(array("\r\n", "\n", "\r", "<p></p>"), array("", "", "", ""), $dt_table[$i]['content']).'</ul>';
  337.             $columnContent .= '</div>';
  338.         }
  339.         $finished_table = '<div class="pricing-table">'.$columnContent.'</div>';
  340.     }
  341.    
  342.     $dt_table = '';
  343.    
  344.     return $finished_table;
  345.    
  346. }
  347.  
  348. add_shortcode('pricing-table', 'delicious_pricing_table');
  349.  
  350.  
  351. // Single Column
  352. function shortcode_pricing_column( $atts, $content = null ) {
  353.     global $dt_table;
  354.     extract(shortcode_atts(array(
  355.         'title' => '',
  356.         'price' => '',
  357.         'currency' => '',
  358.         'interval' => '',
  359.         'featured' => 'false'
  360.     ), $atts));
  361.    
  362.     $featured = strtolower($featured);
  363.    
  364.     $column['title'] = $title;
  365.     $column['price'] = $price;
  366.     $column['currency'] = $currency;
  367.     $column['interval'] = $interval;
  368.     $column['featured'] = ( $featured == 'true' || $featured == 'yes' || $featured == '1' ) ? true : false;
  369.     $column['content'] = do_shortcode($content);
  370.    
  371.     $dt_table[] = $column;
  372.    
  373. }
  374.  
  375. add_shortcode('pricing-column', 'shortcode_pricing_column');
  376.  
  377.  
  378. // signup area
  379. function shortcode_signup( $atts, $content = null )
  380. {    
  381.     return '<div class="signup">'. do_shortcode($content) .'</div>';
  382. }
  383.  
  384. add_shortcode('signup', 'shortcode_signup');
  385.  
  386.  
  387.  
  388. /*-----------------------------------------------------------------------------------*/
  389. /*  Clients Shortcode
  390. /*-----------------------------------------------------------------------------------*/
  391.  
  392. function delicious_clients( $atts, $content = null ) {
  393.     extract( shortcode_atts( array(
  394.         'images' => '',
  395.         'title' => ''
  396.     ), $atts ) );
  397.         $array_images = explode(",", $images);
  398.        
  399.         $clientItem = '';
  400.        
  401.         $clientItem .= '<section class="homepage-clients">';
  402.         if(!empty($title)) {
  403.             $clientItem .= '<h2>'.$title.'</h2>';
  404.         }
  405.         $clientItem .= '<ul class="clients">';
  406.        
  407.             foreach($array_images as $single_image) {
  408.                
  409.                 $image_attributes = wp_get_attachment_image_src( $single_image );
  410.                
  411.                 $clientItem .='<li>';
  412.                 $clientItem .='<a>';
  413.                 $clientItem .='<img src="'.$image_attributes[0].'" width="'. $image_attributes[1].'" height="'. $image_attributes[2].'" />';
  414.                 $clientItem .='</a>';
  415.                 $clientItem .='</li>';
  416.             }
  417.         $clientItem .= '</ul>';
  418.         $clientItem .= '</section>';
  419.         $clientItem .= '<div class="half-space"></div>';
  420.    
  421.     return $clientItem;
  422.    
  423. }
  424.  
  425. add_shortcode('clients', 'delicious_clients');
  426.  
  427.  
  428.  
  429. /*-----------------------------------------------------------------------------------*/
  430. /*  Blog Grid Shortcode
  431. /*-----------------------------------------------------------------------------------*/
  432.  
  433. function delicious_blog_grid($atts, $content = null) {
  434.     extract(shortcode_atts(array(
  435.         "number" => "6",
  436.         "columns" => "3",
  437.         "categories" => ""
  438.        
  439.     ), $atts));
  440.    
  441.     global $post;
  442.    
  443.     wp_enqueue_script('isotope', get_template_directory_uri() . '/js/jquery.isotope.min.js', array('jquery'), '1.0', false );  
  444.     wp_enqueue_script('custom-isotope', get_template_directory_uri() . '/js/custom-isotope.js', array('isotope'), '1.0', false );
  445.     wp_enqueue_script('custom-slides', get_template_directory_uri() . '/js/custom-slides.js', array('slides'), '1.0', false );
  446.     wp_enqueue_script('jplayer');
  447.  
  448.     $blog_id = 'masonry-blog';
  449.     $blog_class = 'columns-three'; 
  450.    
  451.     if($columns == '3') {
  452.         $blog_class = 'columns-three';
  453.     }
  454.     if($columns == '2') {
  455.         $blog_class = 'columns-two';
  456.     }
  457.    
  458.     $output = '';
  459.         $blog_array_cats = get_terms('category', array('hide_empty' => false));
  460.         if(empty($categories)) {
  461.             foreach($blog_array_cats as $blog__array_cat) {
  462.                 $categories .= $blog__array_cat->slug .', ';
  463.             }
  464.         }
  465.        
  466.         $args = array(
  467.             'orderby'=> 'post_date',
  468.             'order' => 'date',
  469.             'post_type' => 'post',
  470.             'category_name' => $categories,
  471.             'posts_per_page' => $number
  472.         );
  473.        
  474.         $my_query = new WP_Query($args);
  475.         if( $my_query->have_posts() ) {
  476.        
  477.             $output .= '<div class="blog-page">';
  478.                 $output .= '<section id="'. $blog_id.'" class="vc_blog_shortcode '.$blog_class.'">';   
  479.        
  480.                 while ($my_query->have_posts()) : $my_query->the_post();
  481.            
  482.                     ob_start();  
  483.                     get_template_part('format', get_post_format());  
  484.                     $result = ob_get_contents();  
  485.                     ob_end_clean();
  486.                     $output .= $result;
  487.            
  488.                 endwhile;
  489.            
  490.                 $output .= '</section>';
  491.             $output .= '</div>';   
  492.             }
  493.         wp_reset_query();
  494.     return $output;
  495. }
  496.  
  497. add_shortcode("blog-grid", "delicious_blog_grid"); 
  498.  
  499.  
  500.  
  501. /*-----------------------------------------------------------------------------------*/
  502. /*  Portfolio Grid Shortcode
  503. /*-----------------------------------------------------------------------------------*/
  504.  
  505. function delicious_portfolio_grid($atts, $content = null) {
  506.     extract(shortcode_atts(array(
  507.         "title" => "Selected Works",
  508.         "number" => "-1",
  509.         "categories" => ""
  510.     ), $atts));
  511.    
  512.     global $post;
  513.    
  514.     wp_enqueue_script('isotope', get_template_directory_uri() . '/js/jquery.isotope.min.js', array('jquery'), '1.0', false );  
  515.     wp_enqueue_script('custom-isotope', get_template_directory_uri() . '/js/custom-isotope.js', array('jquery'), '1.0', false );
  516.    
  517.         $layout = get_post_meta($post->ID,'dt_portfolio_columns',true);
  518.         $navig = get_post_meta($post->ID,'dt_portfolio_navigation',true);
  519.         $nav_number = get_post_meta($post->ID,'dt_nav_number',true);   
  520.        
  521.         $cats = explode(",", $categories);
  522.        
  523.         $portfolio_categs = get_terms('portfolio_cats', array('hide_empty' => false));
  524.         $categ_list = '';
  525.        
  526.         foreach ($cats as $categ) {
  527.             foreach($portfolio_categs as $portfolio_categ) {
  528.                 if($categ === $portfolio_categ->name) {
  529.                     $categ_list .= $portfolio_categ->slug . ', ';
  530.                 }
  531.             }
  532.         }
  533.            
  534.         //fallback categories
  535.             $args = array(
  536.                 'post_type'=>'portfolio',
  537.                 'taxonomy' => 'portfolio_cats'
  538.             );     
  539.             $categ_fall = get_categories( $args );
  540.             $categ_use = array();
  541.             $i = 0;
  542.             foreach($categ_fall as $cate) {
  543.                 $categ_use[$i] = $cate->name;
  544.                 $i++;
  545.             }
  546.             $cats = array_filter($cats);
  547.             if(empty($cats)) {
  548.                 $cats = array_merge($cats, $categ_use);
  549.             }          
  550.            
  551.            
  552.             $term_list = '';
  553.             $list = '';
  554.            
  555.             foreach ($cats as $cat) {
  556.                 $to_replace = array(' ', '/', '&');
  557.                 $intermediate_replace = strtolower(str_replace($to_replace, '-', $cat));
  558.                 $str = preg_replace('/--+/', '-', $intermediate_replace);
  559.                 if (function_exists('icl_t')) {
  560.                 $term_list .= '<li><a href="#filter" data-option-value=".'. get_taxonomy_cat_ID($cat) .'">' . icl_t('Portfolio Category', 'Term '.get_taxonomy_cat_ID( $cat ).'', $cat) . '</a></li>';
  561.                 }
  562.                 else
  563.                 $term_list .= '<li><a href="#filter" data-option-value=".'. get_taxonomy_cat_ID($cat) .'">' . $cat . '</a></li>';
  564.                 $list .= $cat . ', ';
  565.             }      
  566.            
  567.        
  568.     $output = '';
  569.         $output .= '<section class="homepage-grid">';
  570.             $output .= '<div class="bgtitle"><h2>'.$title.'</h2></div>';
  571.                 $output .= '<section id="options">';
  572.                     $output .= '<ul id="home-filters" class="option-set clearfix" data-option-key="filter">';
  573.                         $output .= '<li><a href="#filter" data-option-value="*" class="selected active">'.__('All', 'delicious').'</a></li>';
  574.                         $output .= $term_list;
  575.                     $output .= '</ul>';
  576.                 $output .= '</section>';
  577.                
  578.             $output .= '<section id="portfolio-wrapper">';
  579.                 $output .= '<ul class="portfolio grid isotope">';
  580.  
  581.                 $args = array(
  582.                     'post_type'=>'portfolio',
  583.                     'posts_per_page' => $number,
  584.                     'term' => 'portfolio_cats',
  585.                     'portfolio_cats' => $categ_list
  586.                 );
  587.                
  588.                 $my_query = new WP_Query($args);
  589.                 if( $my_query->have_posts() ) {
  590.                     while ($my_query->have_posts()) : $my_query->the_post();
  591.  
  592.                     $terms = get_the_terms( get_the_ID(), 'portfolio_cats' );
  593.                     $term_val = '';
  594.                     if($terms) { foreach ($terms as $term) { $term_val .=get_taxonomy_cat_ID($term->name) .' '; } }
  595.                    
  596.                     $portf_icon = get_post_meta($post->ID,'dt_portf_icon',true);                       
  597.                         $portf_thumbnail = get_post_meta($post->ID,'dt_portf_thumbnail',true);                     
  598.                         $thumb_id = get_post_thumbnail_id($post->ID);
  599.                        
  600.                         $image_url = wp_get_attachment_url($thumb_id);
  601.                        
  602.                         $grid_thumbnail = $image_url;
  603.                         $item_class = 'item-small';
  604.                        
  605.                         switch ($portf_thumbnail) {
  606.                             case 'portfolio-big':
  607.                                 $grid_thumbnail = aq_resize($image_url, 550, 450, true);
  608.                                 $item_class = 'item-wide';
  609.                                 break;
  610.                             case 'portfolio-small':
  611.                                 $grid_thumbnail = aq_resize($image_url, 265, 215, true);
  612.                                 $item_class = 'item-small';
  613.                                 break;
  614.                             case 'half-horizontal':
  615.                                 $grid_thumbnail = aq_resize($image_url, 550, 215, true);
  616.                                 $item_class = 'item-long';
  617.                                 break;
  618.                             case 'half-vertical':
  619.                                 $grid_thumbnail = aq_resize($image_url, 265, 450, true);
  620.                                 $item_class = 'item-high';
  621.                                 break;                         
  622.                         }  
  623.                        
  624.                         //retrieve portfolio video
  625.                         if ($portf_icon == 'lightbox_to_video') {
  626.                             $portfolio_slide = get_post_meta($post->ID,'dt_slider_repeat',true);
  627.                                 if(!empty($portfolio_slide)) {
  628.                                     $get_video = array();
  629.                                     $j=0;
  630.                                     foreach ($portfolio_slide as $slide){
  631.                                         $video = $slide['dt_video_field_id'];
  632.                                         if (!empty($video)) {
  633.                                             $get_video[$j] = $video;
  634.                                             $j++;
  635.                                         }
  636.                                        
  637.                                     }                                  
  638.                                 }
  639.                                 $video_output = '';
  640.                                 $input_string = $get_video[0];
  641.                                 $count = preg_match('/src=(["\'])(.*?)\1/', $input_string, $match);
  642.                                 if ($count === FALSE)
  643.                                     $video_output = 'not found';
  644.                                 else
  645.                                     $video_output = $match[2];                 
  646.                         }
  647.  
  648.                     $copy = $terms;
  649.                     $res = '';
  650.                     if($terms) {
  651.                         foreach ( $terms as $term ) {
  652.                             if (function_exists('icl_t')) {
  653.                                 $res .= icl_t('Portfolio Category', 'Term '.get_taxonomy_cat_ID( $term->name ).'', $term->name);
  654.                             }
  655.                             else $res .= $term->name;
  656.                             if (next($copy )) {
  657.                                 $res .=  ', ';
  658.                             }
  659.                         }
  660.                     }                  
  661.  
  662.  
  663.                     $output .= '<li class="isotope-item '.$term_val.' '.$item_class.'">';
  664.                    
  665.                     $test_link = '';
  666.                     switch($portf_icon) {
  667.                         case 'lightbox_to_image':
  668.                             $test_link = '<a href="'. wp_get_attachment_url($thumb_id) .'" rel="prettyPhoto" title="'. get_the_title() .'">';
  669.                             break;
  670.                         case 'link_to_page':
  671.                             $test_link = '<a href="'.get_permalink($post->ID).'">';
  672.                             break;
  673.                         case 'lightbox_to_video':
  674.                             $test_link = '<a href="'.$video_output.'">';
  675.                             break;                         
  676.                     }
  677.  
  678.                         $output .= $test_link;
  679.                         $output .= '<div class="grid-item-on-hover">';
  680.                             $output .= '<div class="grid-text">';
  681.                                 $output .= '<h1>'.get_the_title().'</h1>';
  682.                             $output .= '</div>';
  683.                             $output .= '<div><span>';  
  684.                                 $output .= $res;
  685.                             $output .='</span></div>';
  686.                            
  687.                         $output .= '</div>';
  688.                         $output .= '<div><img src="'. $grid_thumbnail.'" alt="" />';
  689.                         $output .= '</div></a>';
  690.        
  691.                     $output .= '</li>';
  692.                 endwhile;
  693.                 }
  694.                 wp_reset_query();
  695.                 $output .= '</ul>';
  696.             $output .= '</section>';
  697.     $output .= '</section>';
  698.     $output .= '<div class="space"></div>';
  699.     return $output;
  700. }
  701.  
  702. add_shortcode("portfolio-grid", "delicious_portfolio_grid");   
  703.  
  704.  
  705.  
  706. /*-----------------------------------------------------------------------------------*/
  707. /*  Portfolio Carousel Shortcode
  708. /*-----------------------------------------------------------------------------------*/
  709.  
  710. function delicious_portfolio_carousel($atts, $content = null) {
  711.     extract(shortcode_atts(array(
  712.         "title" => "Our Works",
  713.         "number" => "8",
  714.         "categories" => ""
  715.     ), $atts));
  716.    
  717.     global $post;
  718.    
  719.     wp_enqueue_script('carousel');
  720.     wp_enqueue_script('touchwipe');
  721.     wp_enqueue_script('portfolio-carousel');
  722.    
  723.     $output = '';
  724.    
  725.     $output = '<div class="bgtitle"><h2>'.$title.'</h2></div>';
  726.    
  727.     $output .= '<div id="portfolio-carousel-wrapper" class="any-carousel">';
  728.         $output .= '<a href="#" class="jcarousel-control-prev"></a>';
  729.         $output .= '<a href="#" class="jcarousel-control-next"></a>';
  730.         $output .='<div id="portfolio-carousel">';
  731.             $output .= '<ul>';
  732.            
  733.             $args = array(
  734.                 'orderby'=> 'post_date',
  735.                 'order' => 'date',
  736.                 'post_type' => 'portfolio',
  737.                 'posts_per_page' => $number,
  738.                 'term' => 'portfolio_cats',
  739.                 'portfolio_cats' => $categories
  740.             );
  741.            
  742.             $my_query = new WP_Query($args);
  743.             if( $my_query->have_posts() ) {
  744.                 while ($my_query->have_posts()) : $my_query->the_post();
  745.                
  746.                 $terms = get_the_terms( get_the_ID(), 'portfolio_cats' );
  747.                 $output .= '<li>';
  748.                
  749.                 $portf_icon = get_post_meta($post->ID,'dt_portf_icon',true);                       
  750.                 $thumb_id = get_post_thumbnail_id($post->ID);
  751.                
  752.                 // Check if wordpress supports featured images, and if so output the thumbnail
  753.                 if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) :  
  754.                
  755.                     if ($portf_icon == 'lightbox_to_image') {
  756.                         $output .= '<a href="'. wp_get_attachment_url($thumb_id). '" rel="prettyPhoto">';
  757.                             $output .= '<span class="item-on-hover">';
  758.                                 $output .= '<span class="hover-image"></span>';
  759.                             $output .= '</span>';
  760.                             $output .= get_the_post_thumbnail(get_the_ID(), 'portfolio-thumb');
  761.                         $output .= '</a>';
  762.                     }
  763.                     else if ($portf_icon == 'link_to_page') {
  764.                         $output .= '<a href="'.get_permalink($post->ID).'">';
  765.                             $output .= '<span class="item-on-hover">';
  766.                                 $output .= '<span class="hover-link"></span>';
  767.                             $output .= '</span>';
  768.                             $output .= get_the_post_thumbnail(get_the_ID(), 'portfolio-thumb');
  769.                         $output .= '</a>';
  770.                        
  771.                     }  
  772.                     else if ($portf_icon == 'lightbox_to_video') {
  773.                    
  774.                         $portfolio_slide = get_post_meta($post->ID,'dt_slider_repeat',true);
  775.                             if(!empty($portfolio_slide)) {
  776.                                 $get_video = array();
  777.                                 $j=0;
  778.                                 foreach ($portfolio_slide as $slide){
  779.                                     $video = $slide['dt_video_field_id'];
  780.                                     if (!empty($video)) {
  781.                                         $get_video[$j] = $video;
  782.                                         $j++;
  783.                                     }
  784.                                 }                                  
  785.                             }
  786.                            
  787.                             $video_output = '';
  788.                             $input_string = $get_video[0];
  789.                             $count = preg_match('/src=(["\'])(.*?)\1/', $input_string, $match);
  790.                                 if ($count === FALSE)
  791.                                     $video_output = 'not found\n';
  792.                                 else
  793.                                     $video_output = $match[2]; 
  794.                                    
  795.                             $output .= '<a href="'.$video_output.'">';
  796.                                 $output .= '<span class="item-on-hover">';
  797.                                     $output .= '<span class="hover-video"></span>';
  798.                                 $output .= '</span>';
  799.                                 $output .= get_the_post_thumbnail(get_the_ID(), 'portfolio-thumb');
  800.                             $output .= '</a>';
  801.                     }
  802.                     endif;
  803.                    
  804.                     $output .= '<div class="portfolio-carousel-details">';
  805.                         $output .= '<h3><a href="'. get_permalink($post->ID) .'">'. get_the_title() .'</a></h3>';
  806.                         $output .= '<span>';
  807.                             if(!empty($terms)) {
  808.                                 $copy = $terms;
  809.                                     foreach ( $terms as $term ) {
  810.                                     if (function_exists('icl_t')) {
  811.                                         $output .= icl_t('Portfolio Category', 'Term '.get_taxonomy_cat_ID( $term->name ).'', $term->name);
  812.                                     }
  813.                                     else {
  814.                                         $output .= $term->name;
  815.                                     }
  816.                                         if (next($copy )) {
  817.                                             $output .=  ', ';
  818.                                         }
  819.                                     }
  820.                             }
  821.                         $output .= '</span>';                      
  822.                     $output .= '</div>';
  823.                 $output .= '</li>';
  824.             endwhile; wp_reset_query();
  825.             }
  826.         $output .= '</ul>';
  827.         $output .= '</div>';
  828.     $output .='</div>';
  829.     $output .= '<div class="space"></div>';
  830.    
  831.     return $output;
  832. }
  833.  
  834. add_shortcode("portfolio-carousel", "delicious_portfolio_carousel");
  835.  
  836.  
  837.  
  838. /*-----------------------------------------------------------------------------------*/
  839. /*  Blog Carousel Shortcode
  840. /*-----------------------------------------------------------------------------------*/
  841.  
  842. function delicious_homeblog_carousel($atts, $content = null) {
  843.     extract(shortcode_atts(array(
  844.         "title" => "From the Blog",
  845.         "number" => "6",
  846.         "categories" => ""
  847.     ), $atts));
  848.    
  849.     global $post;
  850.    
  851.        
  852.     wp_enqueue_script('carousel');
  853.     wp_enqueue_script('touchwipe');
  854.     wp_enqueue_script('blog-carousel');
  855.    
  856.     $output = '';
  857.    
  858.     $output = '<div class="bgtitle"><h2>'.$title.'</h2></div>';
  859.    
  860.     $output .= '<div id="blog-carousel-wrapper" class="any-carousel">';
  861.         $output .= '<a href="#" class="jcarousel-control-prev"></a>';
  862.         $output .= '<a href="#" class="jcarousel-control-next"></a>';
  863.         $output .='<div id="homeblog-carousel">';
  864.             $output .= '<ul>';
  865.            
  866.         $blog_array_cats = get_terms('category', array('hide_empty' => false));
  867.         if(empty($categories)) {
  868.             foreach($blog_array_cats as $blog__array_cat) {
  869.                 $categories .= $blog__array_cat->slug .', ';
  870.             }
  871.         }
  872.        
  873.             $args = array(
  874.                 'orderby'=> 'post_date',
  875.                 'order' => 'date',
  876.                 'post_type' => 'post',
  877.                 'category_name' => $categories,
  878.                 'posts_per_page' => $number
  879.             );
  880.            
  881.             $my_query = new WP_Query($args);
  882.             if( $my_query->have_posts() ) {
  883.                 while ($my_query->have_posts()) : $my_query->the_post();
  884.                
  885.                 $time = get_the_time(get_option('date_format'));
  886.  
  887.                 $output .= '<li>';
  888.                
  889.                     $output .= '<a href="'.get_permalink($post->ID).'">';
  890.                         $output .= '<span class="item-on-hover"></span>';
  891.                         if ( has_post_thumbnail() ) {
  892.                             $output .= get_the_post_thumbnail(get_the_ID(), 'blog-home-thumb');
  893.                         }
  894.                         else {
  895.                        
  896.                             $output .='<div class="homeblog-thumbnail">';
  897.                             $output .= dt_blog_icon($post->ID);
  898.                             $output .= '</div>';
  899.                         }                          
  900.                     $output .= '</a>';
  901.                         $output .= '<div class="blog-carousel-details">';
  902.                             $output .= '<h2><a href="'.get_permalink($post->ID).'">'. get_the_title() .'</a></h2>';
  903.                             $output .= '<div class="carousel-meta">';
  904.                                 $output .= '<span class="post-format">';
  905.                                     $output .= dt_blog_icon($post->ID);
  906.                                 $output .= '</span>';
  907.                                 $output .='<span class="details">';
  908.                                 $output .= $time .' / '. get_comments_popup_link(__('No Comments &raquo;', 'delicious'), __('1 Comment &raquo;', 'delicious'), __('% Comments &raquo;', 'delicious'));
  909.                                 $output .= '</span>';
  910.                             $output .= '</div>';
  911.                             $output .=  '<p>'.get_the_excerpt().'</p>';
  912.                         $output .= '</div>';
  913.                 $output .= '</li>';
  914.             endwhile; wp_reset_query();
  915.             }
  916.         $output .= '</ul>';
  917.         $output .= '</div>';
  918.     $output .='</div>';
  919.     $output .= '<div class="space"></div>';
  920.    
  921.     return $output;
  922. }
  923.  
  924. add_shortcode("homeblog-carousel", "delicious_homeblog_carousel");
  925.  
  926.  
  927.  
  928. /*-----------------------------------------------------------------------------------*/
  929. /*  Services Item
  930. /*-----------------------------------------------------------------------------------*/
  931.  
  932. function delicious_services($atts, $content = null) {
  933.     extract(shortcode_atts(array(
  934.         "id" => ''
  935.     ), $atts));
  936.  
  937.     global $post;
  938.    
  939.     $args = array(
  940.         'post_type' => 'services',
  941.         'posts_per_page' => 1,
  942.         'p' => $id
  943.     );
  944.    
  945.     $my_query = new WP_Query($args);
  946.     if( $my_query->have_posts() ) :
  947.     while ($my_query->have_posts()) : $my_query->the_post();
  948.  
  949.  
  950.     $service_icon = get_post_meta($post->ID, 'dt_service_icon', true);
  951.     $service_text = get_post_meta($post->ID, 'dt_service_text', true);
  952.     $service_style = get_post_meta($post->ID, 'dt_service_style', true);
  953.    
  954.     $service_class ='';
  955.    
  956.     if($service_style == "service-style-2") { $service_class = 'second-service';  }
  957.         else
  958.     if($service_style == "service-style-1") { $service_class = 'homepage-services';  }
  959.    
  960.     $retour = '';
  961.     $retour .= '<section class="'.$service_class.'">';
  962.     $retour .='<div class="service-item">';
  963.     $retour .= '<i class="fa '.$service_icon.'"></i>';
  964.     $retour .='<h3 class="service">'.get_the_title().'</h3>';
  965.     $retour .='<p class="clear">'.wp_kses_post($service_text).'</p>';
  966.     $retour .='</div>';
  967.     $retour .='</section>';
  968.  
  969.     endwhile; else:
  970.     $retour ='';
  971.     $retour .= "nothing found.";
  972.     endif;
  973.  
  974.     //Reset Query
  975.     wp_reset_query();
  976.    
  977.     return $retour;
  978. }
  979.  
  980. add_shortcode("service", "delicious_services");
  981.  
  982.  
  983.  
  984. /*-----------------------------------------------------------------------------------*/
  985. /*  Team Member
  986. /*-----------------------------------------------------------------------------------*/
  987.  
  988. function delicious_member($atts, $content = null) {
  989.     extract(shortcode_atts(array(
  990.         "id" => ''
  991.     ), $atts));
  992.  
  993.     global $post;
  994.  
  995.     $args = array(
  996.         'post_type' => 'team',
  997.         'posts_per_page' => 1,
  998.         'p' => $id
  999.     );
  1000.    
  1001.     $team_query = new WP_Query($args);
  1002.     if( $team_query->have_posts() ) :
  1003.     while ($team_query->have_posts()) : $team_query->the_post();
  1004.    
  1005.     $member_text = get_post_meta($post->ID, 'dt_member_text', true);
  1006.     $position = get_post_meta($post->ID, 'dt_member_position', true);
  1007.     $twitter = get_post_meta($post->ID, 'dt_member_twitter', true);
  1008.     $facebook = get_post_meta($post->ID, 'dt_member_facebook', true);
  1009.     $email = get_post_meta($post->ID, 'dt_member_mail', true);
  1010.     $linkedin = get_post_meta($post->ID, 'dt_member_linkedin', true);
  1011.     $google = get_post_meta($post->ID, 'dt_member_google', true);
  1012.    
  1013.     $mail = is_email($email);
  1014.    
  1015.     $image = get_the_post_thumbnail( $id, 'member-thumb', array('class' => 'team-avatar') );
  1016.     $url_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
  1017.    
  1018.     $retour ='';
  1019.     $retour .='<div class="team-member">';
  1020.         $retour .='<div class="team-details">';
  1021.             $retour .= $image;
  1022.            
  1023.             $retour .='<div class="team-text">';
  1024.                 $retour .='<h3>';
  1025.                 $retour .= get_the_title();
  1026.                 $retour .='</h3>';
  1027.                 if(!empty($position)) {
  1028.                 $retour .='<h6>'.$position.'</h6>'; }
  1029.                 $retour .='<p>'.wp_kses_post($member_text).'</p>';
  1030.             $retour .='</div>';
  1031.        
  1032.             $retour .='<div class="team-social">';
  1033.                 if(!empty($mail)) {
  1034.                 $retour .='<a href="mailto:'.$mail.'"><img src="'. get_template_directory_uri() .'/images/social/team-email.png" alt="Email Address" /></a>';  }   
  1035.                 if(!empty($facebook)) {
  1036.                 $retour .='<a href="'.esc_url($facebook).'"><img src="'. get_template_directory_uri() .'/images/social/team-facebook.png" alt="Facebook Profile" /></a>'; }            
  1037.                 if(!empty($twitter)) {
  1038.                 $retour .='<a href="'.esc_url($twitter).'"><img src="'. get_template_directory_uri() .'/images/social/team-twitter.png" alt="Twitter Page" /></a>'; }
  1039.                 if(!empty($google)) {
  1040.                 $retour .='<a href="'.esc_url($google).'"><img src="'. get_template_directory_uri() .'/images/social/team-google.png" alt="Google+ Profile" /></a>'; }                     
  1041.                 if(!empty($linkedin)) {
  1042.                 $retour .='<a href="'.esc_url($linkedin).'"><img src="'. get_template_directory_uri() .'/images/social/team-linkedin.png" alt="Linkedin Profile" /></a>'; }        
  1043.             $retour .='</div>';
  1044.         $retour .='</div>';
  1045.     $retour .='</div>';
  1046.  
  1047.      endwhile; else:
  1048.      $retour ='';
  1049.      $retour .= "nothing found.";
  1050.      endif;
  1051.  
  1052.     //Reset Query
  1053.     wp_reset_query();
  1054.    
  1055.     return $retour;
  1056. }
  1057. add_shortcode("team-member", "delicious_member");
  1058.  
  1059.  
  1060.  
  1061. /*-----------------------------------------------------------------------------------*/
  1062. /*  Portfolio Homepage Carousel
  1063. /*-----------------------------------------------------------------------------------*/
  1064.  
  1065. function delicious_portfolio($atts, $content = null) {
  1066.     extract(shortcode_atts(array(
  1067.         "items" => '5',
  1068.         "title" => 'RECENT PROJECTS'
  1069.     ), $atts));
  1070.    
  1071.     global $post;
  1072.    
  1073.     $retour ='';
  1074.     $retour .= '<div class="centered-wrapper">';
  1075.     $retour .= '<section>';
  1076.     $retour .= '<div class="bgtitle"><h2>';
  1077.     $retour .= $title;
  1078.     $retour .= '</h2></div>';
  1079.     $retour .= '<ul id="mycarousel">';
  1080.    
  1081.         $args = array(
  1082.             'orderby'=> 'post_date',
  1083.             'order' => 'rand',
  1084.             'post_type' => 'portfolio',
  1085.             'posts_per_page' => $items
  1086.         );
  1087.        
  1088.         $my_query = new WP_Query($args);
  1089.         if( $my_query->have_posts() ) {
  1090.             while ($my_query->have_posts()) : $my_query->the_post();
  1091.            
  1092.             $portf_icon = get_post_meta($post->ID,'dt_portf_icon',true);   
  1093.             $thumb_id = get_post_thumbnail_id($post->ID);
  1094.  
  1095.             $mythumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'portfolio-thumb');
  1096.            
  1097.             if ( has_post_thumbnail() ) {
  1098.                 $retour .='<li>';
  1099.  
  1100.                 if ($portf_icon == 'lightbox_to_image') {  
  1101.                     $retour .='<a href="'. wp_get_attachment_url($thumb_id) .'" title="'. get_the_title() .'" rel="prettyPhoto">';
  1102.                     $retour .='<span class="item-on-hover"><span class="hover-image"></span></span>';
  1103.                     $retour .='<img src="'. $mythumbnail[0] .'" height="'. $mythumbnail[2] .'" width="'. $mythumbnail[1] .'" alt="'. get_the_title() .'" /></a>';                      
  1104.                 }              
  1105.                
  1106.                 else       
  1107.                 if ($portf_icon == 'link_to_page') {
  1108.                     $retour .='<a href="'. get_permalink() .'" title="'. get_the_title() .'">';
  1109.                     $retour .='<span class="item-on-hover"><span class="hover-link"></span></span>';
  1110.                     $retour .='<img src="'. $mythumbnail[0] .'" height="'. $mythumbnail[2] .'" width="'. $mythumbnail[1] .'" alt="'. get_the_title() .'" /></a>';
  1111.                 }
  1112.                    
  1113.                 else
  1114.                 if ($portf_icon == 'lightbox_to_video') {
  1115.                     $portfolio_slide = get_post_meta($post->ID,'dt_slider_repeat',true);
  1116.                         if(!empty($portfolio_slide)) {
  1117.                             $get_video = array();
  1118.                             $j=0;
  1119.                             foreach ($portfolio_slide as $slide){
  1120.                                 $video = $slide['dt_video_field_id'];
  1121.                                 if (!empty($video)) {
  1122.                                     $get_video[$j] = $video;
  1123.                                     $j++;
  1124.                                 }  
  1125.                             }                                  
  1126.                         }
  1127.                        
  1128.                         $input_string = $get_video[0];
  1129.                         $ret_video = '';
  1130.                         $count = preg_match('/src=(["\'])(.*?)\1/', $input_string, $match);
  1131.                         if ($count === FALSE)
  1132.                             $ret_video = 'not found';
  1133.                         else
  1134.                             $ret_video = $match[2] ;                       
  1135.  
  1136.                     $retour .='<a href="'. $ret_video .'" title="'. get_the_title() .'">';
  1137.                     $retour .='<span class="item-on-hover"><span class="hover-video"></span></span>';
  1138.                     $retour .='<img src="'. $mythumbnail[0] .'" height="'. $mythumbnail[2] .'" width="'. $mythumbnail[1] .'" alt="'. get_the_title() .'" /></a>';          
  1139.                 }
  1140.                    
  1141.                 $retour .='<span class="caption"><a href="'. get_permalink() .'">'. get_the_title() .'</a></span>';
  1142.                 $retour .='</li>';
  1143.             }
  1144.             endwhile; wp_reset_query(); }
  1145.         $retour .='</ul>';
  1146.     $retour .='</section>';
  1147.     $retour .='</div><!--end centered-wrapper-->';
  1148.    
  1149.         return $retour;
  1150.  
  1151. }
  1152.  
  1153. add_shortcode("portfolio", "delicious_portfolio");
  1154.  
  1155.  
  1156.  
  1157. /*-----------------------------------------------------------------------------------*/
  1158. /*  Testimonial Item
  1159. /*-----------------------------------------------------------------------------------*/
  1160.  
  1161. function delicious_testimonials($atts, $content = null) {
  1162.     extract(shortcode_atts(array(
  1163.         "id" => ''
  1164.     ), $atts));
  1165.  
  1166.     global $post;
  1167.    
  1168.     $args = array(
  1169.         'post_type' => 'testimonials',
  1170.         'posts_per_page' => 1,
  1171.         'p' => $id
  1172.     );
  1173.     $my_query = new WP_Query($args);
  1174.     if( $my_query->have_posts() ) :
  1175.     while ($my_query->have_posts()) : $my_query->the_post();
  1176.    
  1177.     $testimonial_desc = get_post_meta($post->ID, 'dt_testimonial_desc', true); 
  1178.     $testimonial_name = get_post_meta($post->ID, 'dt_testimonial_name', true); 
  1179.     $testimonial_details = get_post_meta($post->ID, 'dt_testimonial_details', true);   
  1180.    
  1181.     $retour ='';
  1182.    
  1183.     $retour .='<div class="testimonial-wrap">';
  1184.     $retour .='<div class="testimonial-item">';
  1185.     $retour .='<p>'.wp_kses_post($testimonial_desc).'</p>';
  1186.     $retour .='<div class="testimonial-pin"></div>';
  1187.     $retour .='<div class="testimonial-meta">';
  1188.     $retour .='<h5>'.esc_html($testimonial_name).'</h5>, <span>'.esc_html($testimonial_details).'</span>';
  1189.     $retour .='</div>';
  1190.     $retour .='</div>';
  1191.     $retour .='</div>';
  1192.  
  1193.     endwhile; else:
  1194.     $retour ='';
  1195.     $retour .= "nothing found.";
  1196.     endif;
  1197.  
  1198.     //Reset Query
  1199.     wp_reset_query();
  1200.    
  1201.     return $retour;
  1202. }
  1203.  
  1204. add_shortcode("testimonial", "delicious_testimonials");
  1205.  
  1206.  
  1207.  
  1208. /*-----------------------------------------------------------------------------------*/
  1209. /*  CF7 Shortcode Hack
  1210. /*-----------------------------------------------------------------------------------*/
  1211.  
  1212. add_filter( 'wpcf7_form_elements', 'mycustom_wpcf7_form_elements' );
  1213.  
  1214. function mycustom_wpcf7_form_elements( $form ) {
  1215. $form = do_shortcode( $form );
  1216.  
  1217. return $form;
  1218. }
  1219.  
  1220.  
  1221.  
  1222. /*-----------------------------------------------------------------------------------*/
  1223. /*  Shortcode Filter
  1224. /*-----------------------------------------------------------------------------------*/
  1225. add_filter('the_content', 'do_shortcode', 7);
  1226. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement