PageRenderTime 245ms CodeModel.GetById 121ms app.highlight 63ms RepoModel.GetById 38ms app.codeStats 2ms

/wp-content/themes/lifeline/framework/helpers/shortcodes.php

https://bitbucket.org/acipriani/madeinapulia.com
PHP | 2876 lines | 2546 code | 153 blank | 177 comment | 265 complexity | 834353c4d733dc37f5b571ce0c749483 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1<?php
   2class SH_Shortcodes
   3{
   4    protected $keys;
   5    protected $toggle_count = 0;
   6    function __construct()
   7    {
   8        $GLOBALS['sh_toggle_count'] = 0;
   9        add_action('init', array($this, 'add'));
  10    }
  11    function add()
  12    {
  13        include(SH_FRW_DIR . 'resource/shortcodes.php');
  14        $this->keys = array_keys($options);
  15        foreach ($this->keys as $k) {
  16            if (method_exists($this, $k)) add_shortcode('sh_' . $k, array($this, $k));
  17        }
  18    }
  19    function recent_news($atts, $content = null)
  20    {
  21        extract(shortcode_atts(array(
  22                'number' => '',
  23                'title' => __('Recent News', SH_NAME),
  24                'category' => '',
  25                'sort_by' => 'date',
  26                'sorting_order' => 'DESC',
  27                'heading_style' => 'simple',
  28                ), $atts)
  29        );
  30        
  31        $News = $Thumb = '';
  32        wp_reset_query();
  33        $args = array('post_type' => 'post', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order, 'cat' => (int)$category);
  34        //if($category != '') $args['category'] = array($category);
  35        $query = new WP_Query($args);
  36        //printr($query);
  37        $i = 1;
  38        if ($query->have_posts()): while ($query->have_posts()): $query->the_post();
  39            $Settings = get_post_meta(get_the_ID(), '_post_settings', true);
  40            if ($video_link = sh_set($Settings, 'video_link')) {
  41                $opt = get_post_meta(get_the_ID(), '_dictate_gal_videos', true);
  42                $video_data = sh_grab_video($video_link, $opt);
  43                $PostMedia = '<div class="image"> 
  44							  <img src="' . sh_set($video_data, 'thumb') . '" style="width:261px; height:207px;" alt="' . sh_set($video_data, 'title') . '" /> 
  45							  <a class="html5lightbox" rel="prettyPhoto" href="' . $video_link . '" title="' . sh_set($video_data, 'title') . '"> 
  46								  <span><i class="icon-play"></i></span> 
  47							  </a> 
  48						  </div>';
  49                $CarouselThumb = '<img src="' . sh_set($video_data, 'thumb') . '" style="width:131px; height:78px;" alt="' . sh_set($video_data, 'title') . '" />';
  50            } else {
  51                $PostAttchment = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'large');
  52                $PostMedia = '<div class="image">
  53							  ' . get_the_post_thumbnail(get_the_ID(), '370x252') . '
  54							  <a title="" href="' . sh_set($PostAttchment, 0) . '" rel="prettyPhoto" class="html5lightbox"><i class="icon-picture"></i></a>
  55						  </div>';
  56                $CarouselThumb = get_the_post_thumbnail(get_the_ID(), '270x155');
  57            }
  58            $News .= '<div id="news' . $i . '">
  59					<div class="row">
  60						<div class="col-md-6 desc">
  61						  <h3><a href="' . get_permalink() . '" title="">' . sh_character_limit(35, get_the_title()) . '</a></h3>
  62						  <p>' . sh_character_limit(340, get_the_content()) . '</p>
  63						</div>
  64						<div class="col-md-6">
  65							' . $PostMedia . '
  66						</div>
  67					</div>
  68				  </div>';
  69            $Thumb .= '<a href="#news' . $i . '">' . $CarouselThumb . '<span class="carusal-our-news">' . sh_character_limit(17, get_the_title()) . '</span></a>';
  70            $i++;
  71        endwhile;
  72        endif;
  73        wp_reset_query();
  74        wp_enqueue_script('carofredcsel');
  75        $output = '';
  76        
  77        
  78        $output .= '<div class="carusal-slider">
  79					  <div id="carousel-wrapper">
  80						<div id="carousel">
  81						  ' . $News . ' 
  82						</div>
  83					  </div>
  84					  <div id="thumbs-wrapper">
  85						<div id="thumbs">' . $Thumb . '</div>
  86						<a id="prev" href="#"><i class="icon-angle-left"></i></a> <a id="next" href="#"><i class="icon-angle-right"></i></a> </div>
  87					</div>
  88					<script>
  89					jQuery(document).ready(function($){
  90						 $(\'#carousel\').carouFredSel({
  91						  responsive: true,
  92						  circular: false,
  93						  auto: false,
  94						  items: {
  95						   visible: 1,
  96						   width: 20,
  97						  },
  98						  scroll: {
  99						   fx: \'directscroll\'
 100						  }
 101						 });
 102						 $(\'#thumbs\').carouFredSel({
 103						  responsive: true,
 104						  circular: false,
 105						  infinite: false,
 106						  auto: false,
 107						  prev: \'#prev\',
 108						  next: \'#next\',
 109						  items: {
 110						   visible: {
 111							min: 1,
 112							max: 6
 113						   },
 114						   width: 200,
 115						   height: \'80%\'
 116						  }
 117						 });
 118						 $(\'#thumbs a\').click(function() {
 119						  $(\'#carousel\').trigger(\'slideTo\', \'#\' + this.href.split(\'#\').pop() );
 120						  $(\'#thumbs a\').removeClass(\'selected\');
 121						  $(this).addClass(\'selected\');
 122						  return false;
 123						 });
 124					});
 125					</script>
 126					';
 127        
 128        return $output;
 129    }
 130    function our_causes($atts, $content = null)
 131    {
 132        extract(shortcode_atts(array(
 133                'number' => '',
 134                'title' => __('Our Causes', SH_NAME),
 135                'cat' => '',
 136                'sort_by' => 'date',
 137                'sorting_order' => 'ASC',
 138                'donate_sec' => '',
 139                'heading_style' => 'simple',
 140                
 141            ), $atts)
 142        );
 143        $paypal_res = '';
 144        $single_page = (sh_set($_SESSION, 'sh_causes_page')) ? sh_set($_SESSION, 'sh_causes_page') : false;
 145        if ($single_page == true) unset($_SESSION['sh_causes_page']);
 146        if (isset($_GET['recurring_pp_return']) && $_GET['recurring_pp_return'] == 'return') {
 147            $paypal_res = require_once(get_template_directory() . '/framework/modules/pp_recurring/review.php');
 148        }
 149        $return_url = (is_home()) ? home_url() : get_permalink();
 150        
 151        $args = array('post_type' => 'post', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order);
 152        if ($cat != '') $args['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => (int)$cat));
 153		$Posts = query_posts($args);
 154		
 155        $chunk_num = ($donate_sec == 'true') ? 3 : 4;
 156        $col_class_outer = ($donate_sec == 'true') ? 'col-md-9' : 'col-md-12';
 157        $col_class_inner = ($donate_sec == 'true') ? 'col-md-4' : 'col-md-4';
 158		$postdate = 
 159
 160        $chunk = array_chunk($Posts, $chunk_num);
 161        $output = '';
 162        
 163        $output .= '<div class="row"><div class="' . $col_class_outer . '">';
 164        $output .= '<div class="our-causes">
 165						
 166						  <ul class="slides">';
 167        foreach ($chunk as $p) {
 168            $output .= '<li><div class="row">';
 169            foreach ($p as $pos) {
 170                
 171                $output .= '<div class="' . $col_class_inner . '">
 172								<div class="causes-image">'
 173                    . get_the_post_thumbnail(sh_set($pos, 'ID'), '') . '
 174									<div class="cause-heading">
 175										<h3>' . sh_excerpt(sh_set($pos, 'post_title'), 50) . '</h3>
 176										<div class="meta-news">' .mysql2date('d F Y', sh_set($pos, 'post_date')). '</div>
 177									</div>
 178									<a href="' . get_permalink(sh_set($pos, 'ID')) . '" title="' . sh_set($pos, 'post_title') . '">
 179										<div class="our-causes-hover">
 180										  
 181										  <h3>' . sh_excerpt(sh_set($pos, 'post_title'), 27) . '</h3>
 182										  <div class="meta-news">'  .mysql2date('d F Y', sh_set($pos, 'post_date')). '</div> 
 183										  <p>' . sh_excerpt($pos, 150) . '</p>
 184										  
 185										</div>
 186									</a>
 187								</div>
 188							</div>';
 189            }
 190            $output .= '</div></li>
 191			<script>
 192				jQuery(document).ready(function($){
 193					if( $(\'.our-causes\').length ){
 194				$(\'.our-causes\').flexslider({
 195					animation: "slide",
 196					animationLoop: false,
 197					controlNav: true,	
 198					maxItems: 1,
 199					pausePlay: false,
 200					mousewheel:false,
 201					start: function(slider){
 202					$(\'body\').removeClass(\'loading\');
 203					}
 204				});
 205			}
 206		});
 207		</script>
 208				';
 209        }
 210        wp_reset_query();
 211        $paypal = $GLOBALS['_sh_base']->donation;
 212        if ($notif = $paypal->_paypal->handleNotification()) $paypal_res = $paypal->single_pament_result($notif);
 213        $output .= '</ul></div></div>';
 214        $donation_data = get_option(SH_NAME);
 215        $percent = (sh_set($donation_data, 'paypal_target')) ? (int)str_replace(',', '', sh_set($donation_data, 'paypal_raised')) / (int)str_replace(',', '', sh_set($donation_data, 'paypal_target')) : 0;
 216        $donation_percentage = $percent * 100;
 217        $symbol = (sh_set($donation_data, 'paypal_currency')) ? sh_set($donation_data, 'paypal_currency') : '$';
 218        $donation = '<div class="col-md-3">';
 219        $donation .= '<div class="donate-us-box">
 220					   <h5>' . __('Give Your Donations', SH_NAME) . '</h5>
 221					   <span>' . __('Donation Needed', SH_NAME) . '</span> <span class="amount-figures"><strong>' . $symbol . '</strong> ' . sh_set($donation_data, 'paypal_target') . '!</span> <span>' . __('Collected Donation', SH_NAME) . '</span> <span class="amount-figures coloured"><strong>' . $symbol . '</strong> ' . sh_set($donation_data, 'paypal_raised') . '!</span> 
 222					   <span class="cell"><i class="icon-phone"></i>' . sh_set($donation_data, 'paypal_contact') . '</span>';
 223        if (sh_set($donation_data, 'donate_method') == 'true') {
 224            $donation .= '<a  data-toggle="modal" data-target="#myModal"  class="donate-btn" title="">Donate Us</a>';
 225        } else {
 226            $donation .= $paypal->button(array('currency_code' => sh_set($donation_data, 'paypal_currency_code'), 'item_name' => get_bloginfo('name'), 'return' => $return_url));
 227        }
 228        $donation .= '</div>
 229				   </div>';
 230        $output .= ($donate_sec == 'true') ? $donation : '';
 231        
 232        $output .= '<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">';
 233        if (isset($_GET['recurring_pp_return']) && $_GET['recurring_pp_return'] == 'return') {
 234            $output .= '<div class="donate-popup">' . $paypal_res . '</div>';
 235            $output .= '<script>
 236								jQuery(document).ready(function($){
 237									$(".donate-us-box a.donate-btn").trigger("click");
 238								
 239								});
 240						</script>';
 241        } elseif ($notif = $paypal->_paypal->handleNotification() && isset($notif->ok)) {
 242            $output .= '<div class="donate-popup">' . $paypal_res . '</div>';
 243            $output .= '<script>
 244								jQuery(document).ready(function($){
 245									$(".donate-us-box a.donate-btn").trigger("click");
 246								
 247								});
 248						</script>';
 249        } else {
 250            $Settings = get_option(SH_NAME);
 251            //printr($Settings);
 252            $value = sh_set($Settings, 'transactions_detail');
 253            $output .= '<div class="donate-popup">
 254		<div class="cause-bar">
 255			<div class="cause-box"><h3><span>' . $symbol . '</span>' . sh_set($donation_data, 'paypal_target') . '</h3><i>' . __('NEEDED DONATION', SH_NAME) . '</i></div>
 256			<div class="cause-progress">
 257					<div class="progress-report">
 258					<h6>' . __('PHASES', SH_NAME) . '</h6>
 259					<span>' . $donation_percentage . '%</span>
 260					<div class="progress pattern">
 261						<div class="progress-bar" style="width: ' . $donation_percentage . '%"></div>
 262					</div>
 263				</div>
 264			</div>
 265			<div class="cause-box"><h3><span>' . $symbol . '</span>' . sh_set($donation_data, 'paypal_raised') . '</h3><i>' . __('COLLECTED DONATION', SH_NAME) . '</i></div>
 266			<div class="cause-box donate-drop-btn"><h4>' . __('DONATE NOW', SH_NAME) . '</h4></div>
 267		</div>
 268		<div class="donate-drop-down">
 269			<div class="recursive-periods" align="center">';
 270            if ($value) {
 271                foreach ($value as $val) {
 272                    $output .= '<a style="cursor:pointer;">' . ucwords(str_replace('_', ' ', $val)) . '</a>';
 273                }
 274            }
 275            $output .= '</div>
 276			<div class="amount-btns">';
 277            if (intval(sh_set($Settings, 'pop_up_1st_value')) != '') $output .= '<a style="cursor:pointer;">' . $symbol . '<span>' . sh_set($Settings, 'pop_up_1st_value') . '</span></a>';
 278            if (intval(sh_set($Settings, 'pop_up_2nd_value')) != '') $output .= '<a style="cursor:pointer;">' . $symbol . '<span>' . sh_set($Settings, 'pop_up_2nd_value') . '</span></a>';
 279            if (intval(sh_set($Settings, 'pop_up_3rd_value')) != '') $output .= '<a style="cursor:pointer;">' . $symbol . '<span>' . sh_set($Settings, 'pop_up_3rd_value') . '</span></a>';
 280            if (intval(sh_set($Settings, 'pop_up_4th_value')) != '') $output .= '<a style="cursor:pointer;">' . $symbol . '<span>' . sh_set($Settings, 'pop_up_4th_value') . '</span></a>';
 281            if (intval(sh_set($Settings, 'pop_up_5th_value')) != '') $output .= '<a style="cursor:pointer;">' . $symbol . '<span>' . sh_set($Settings, 'pop_up_5th_value') . '</span></a>';
 282            $output .= '</div><div class="other-amount">
 283					' . $paypal->button(array('item_name' => get_bloginfo('name'), 'amount' => 30, 'return' => $return_url)) . '
 284				</div>';
 285            if (!is_user_logged_in()) {
 286                $output .= '<form id="login" action="" method="post">
 287						<h1>Please Login OR Register first to make recursive donation</h1>
 288						<p class="status"></p>
 289						<label for="username">Username</label>
 290						<input id="username" type="text" name="username">
 291						<label for="password">Password</label>
 292						<input id="password" type="password" name="password">
 293						<a class="lost" href="' . wp_registration_url() . '">Register Now</a>
 294						<input class="submit_button" type="submit" value="Login" name="submit">
 295						<a class="close" href="">(close)</a>
 296						' . wp_nonce_field('ajax-login-nonce', 'security') . '
 297					</form>';
 298            }
 299            $output .= '</div>
 300			</div>
 301		</div></div>';
 302        }
 303        return $output;
 304    }
 305    function our_causes_2($atts, $content = null)
 306    {
 307        extract(shortcode_atts(array(
 308                'number' => '',
 309                'title' => 'Our Causes',
 310                'bg' => '',
 311                'blackish' => '',
 312                'cat' => '',
 313                'sort_by' => 'date',
 314                'heading_style' => 'simple',
 315                'sorting_order' => 'ASC'), $atts)
 316        );
 317        wp_enqueue_script('layersliderscript1');
 318        wp_enqueue_script('layersliderscript2');
 319        $args = array('post_type' => 'dict_causes', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order);
 320        if ($cat != '') $args['tax_query'] = array(array('taxonomy' => 'causes_category', 'field' => 'id', 'terms' => $cat));
 321        $black_layer = ($blackish) ? 'blackish' : '';
 322        $Posts = query_posts($args);
 323        $attach = ($bg) ? wp_get_attachment_image_src($bg, 'large') : '';
 324        $bgimg = ($attach) ? sh_set($attach, 0) : get_template_directory_uri() . '/images/moving-bg.png';
 325		$output = '';
 326        $output .= '<div class="posts-carousel">
 327						<ul class="slides">';
 328        $chunk = array_chunk($Posts, 4);
 329        foreach ($chunk as $p) {
 330            $output .= '<li><div class="row">';
 331            foreach ($p as $pos) {
 332                $Settings = get_post_meta(sh_set($pos, 'ID'), '_dict_causes_settings', true);
 333                if (sh_set($Settings, 'video_link') && sh_set($Settings, 'video_link') != '') {
 334                    $video_link = sh_set($Settings, 'video_link');
 335                    $video_data = sh_grab_video($video_link, $Settings);
 336                    $PostMedia = '<div class="carou-post-img">
 337									  <img src="' . sh_set($video_data, 'thumb') . '" style="width:277px; height:190px;" alt="' . sh_set($video_data, 'title') . '" />
 338									  <a title="' . sh_set($video_data, 'title') . '" href="' . $video_link . '" class="html5lightbox"><i class="icon-play"></i></a>
 339								  </div>';
 340                } else if (sh_set($Settings, 'gallery')) {
 341                    $GalleryAttachments = get_posts(array('post_type' => 'attachment', 'post__in' => explode(',', sh_set($Settings, 'gallery'))));
 342                    $Slides = '';
 343                    foreach ($GalleryAttachments as $Attachment) {
 344                        $Thumb = sh_set(wp_get_attachment_image_src($Attachment->ID, '370x252'), '0');
 345                        $LargeImage = sh_set(wp_get_attachment_image_src($Attachment->ID, 'large'), '0');
 346                        $Slides .= '<li data-masterspeed="500" data-slotamount="7" data-transition="curtain-1">
 347						<img data-bgrepeat="no-repeat" data-bgposition="left top" data-bgfit="cover" alt="slidebg1" src="' . $Thumb . '" draggable="false"> </li>';
 348                        //$i++;
 349                    }
 350                    $PostMedia = '<div class="carou-post-img"><div class="tp-banner2">
 351										<ul>
 352										' . $Slides . '
 353									 </ul>
 354									</div></div>';
 355                } else {
 356                    $PostAttchment = wp_get_attachment_image_src(get_post_thumbnail_id(sh_set($pos, 'ID')), 'large');
 357                    $PostMedia = '<div class="carou-post-img">
 358									  ' . get_the_post_thumbnail(sh_set($pos, 'ID'), '370x252') . '
 359									  <a title="" href="' . sh_set($PostAttchment, 0) . '" class="html5lightbox"><i class="icon-picture"></i></a>
 360								  </div>';
 361                }
 362                $output .= '<div class="col-md-3">
 363								<div class="carou-post">
 364								   ' . $PostMedia . '
 365								   <h4>' . substr(strip_tags(sh_set($pos, 'post_title')), 0, 30) . '</h4>
 366								   <p>' . substr(strip_tags(sh_set($pos, 'post_content')), 0, 200) . '</p>
 367								   <a href="' . get_permalink(sh_set($pos, 'ID')) . '" title="">' . __('Read More', SH_NAME) . '</a> 
 368							   </div>
 369						   </div>';
 370            }
 371            $output .= '</div></li>';
 372        }
 373        $output .= '    </ul>
 374					  </div>
 375					  </div>
 376					  <script>
 377					  jQuery(document).ready(function($){
 378					  if( $(".posts-carousel").length > 0 ){
 379							$(".posts-carousel").flexslider({
 380								animation: "slide",
 381								animationLoop: false,
 382								controlNav: false,	
 383								maxItems: 1,
 384								pausePlay: false,
 385								mousewheel:false,
 386								start: function(slider){
 387								  $("body").removeClass("loading");
 388								}
 389							});
 390						}
 391					  });
 392					  </script>
 393					  ';
 394        wp_reset_query();
 395        return $output;
 396    }
 397    function our_causes_3($atts, $content = null)
 398    {
 399        extract(shortcode_atts(array(
 400                'number' => '',
 401                'title' => 'Our Causes',
 402                'cat' => '',
 403                'sort_by' => 'date',
 404                'sorting_order' => 'ASC',
 405                'heading_style' => 'simple',
 406                ), $atts)
 407        );
 408        wp_enqueue_script(array('bootstrap'));
 409        
 410        $args = array('post_type' => 'dict_causes', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order);
 411        if ($cat != '') $args['tax_query'] = array(array('taxonomy' => 'causes_category', 'field' => 'id', 'terms' => $cat));
 412        $Posts = query_posts($args);
 413        $i = 1;
 414        $Cause = '';
 415        $PostNav = '';
 416        if (have_posts()): while (have_posts()): the_post();
 417            $PostClass = ($i == 1) ? 'tab-pane fade in active' : 'tab-pane fade';
 418            $NavClass = ($i == 1) ? 'active' : '';
 419            $Settings = get_post_meta(get_the_ID(), '_dict_causes_settings', true);
 420            $Cause .= '<div id="tab' . $i . '" class="' . $PostClass . '">
 421
 422								<div class="cause-image"> 
 423									' . get_the_post_thumbnail(get_the_ID(), '1170x312') . '
 424									<div class="meta"> <span>' . __('In', SH_NAME) . ' <i>' . sh_set($Settings, 'location') . '</i></span> </div>
 425									<div class="cause-title">
 426										<h2><a href="' . get_permalink() . '">' . sh_excerpt(get_the_title(), 100) . '</a></h2>
 427									</div>
 428								</div>
 429								<div class="details">
 430									<div class="needed-amount">
 431										<h5><i>' . sh_set($Settings, 'currency_symbol') . '</i>' . sh_set($Settings, 'donation_needed') . '<span>' . __('Donation Needed', SH_NAME) . '</span></h5>
 432									</div>
 433									<p>' . sh_excerpt(get_the_content(), 500) . '</p>
 434								</div>
 435							</div>';
 436            $PostNav[] = '<li class="col-md-4"> <a data-toggle="tab" href="#tab' . $i . '"> ' . get_the_post_thumbnail(get_the_ID(), '1170x455') . ' <span>' . sh_excerpt(get_the_title(), 35) . '</span> </a> </li>';
 437            $i++;
 438        endwhile;
 439        endif;
 440        wp_reset_query();
 441        $nav = '';
 442        if ($PostNav) {
 443            foreach (array_chunk($PostNav, 3) as $chunk) {
 444                $nav .= '<li>
 445							<ul class="nav nav-tabs cause-tabber">';
 446                if (is_array($chunk)) {
 447                    foreach ($chunk as $ch) {
 448                        $nav .= $ch;
 449                    }
 450                }
 451                $nav .= '</ul>
 452						</li>';
 453            }
 454        }
 455        $output = '';
 456        
 457        $output .= '<div class="our-cause-sec">';
 458        
 459        $output .= '<div class="tab-content" id="myTabContent">' . $Cause . '</div>
 460						
 461							<div class="causes-carousel">
 462								<ul class="slides">
 463									' . $nav . '
 464								</ul>
 465							</div>
 466						
 467					</div>
 468					<script>
 469					jQuery(document).ready(function($){
 470					if( $(\'.causes-carousel\').length > 0 )
 471						{
 472						$(\'.causes-carousel\').flexslider({
 473							animation: "slide",
 474							animationLoop: false,
 475							controlNav: false,	
 476							pausePlay: false,
 477							mousewheel:false,
 478							start: function(slider){
 479							  $(\'body\').removeClass(\'loading\');
 480							}
 481						});
 482						}
 483					});
 484					</script>
 485					';
 486        
 487        return $output;
 488    }
 489    function our_causes_4($atts, $content = null)
 490    {
 491        extract(shortcode_atts(array(
 492                'number' => '',
 493                'title' => 'Our Causes',
 494                'cat' => '',
 495                'sort_by' => 'date',
 496                'sorting_order' => 'ASC',
 497                'heading_style' => 'simple',
 498                ), $atts)
 499        );
 500        
 501        $args = array('post_type' => 'dict_causes', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order);
 502        if ($cat != '') $args['tax_query'] = array(array('taxonomy' => 'causes_category', 'field' => 'id', 'terms' => $cat));
 503        $Posts = query_posts($args);
 504        $TotalPosts = count($Posts);
 505        $PostBatch = 2;
 506        $EndingTagAppended = FALSE;
 507        $StrtingTag = '<div class="col-md-4">';
 508        $CloseTag = '</div>';
 509        $i = 1;
 510        $Cause = '';
 511        $NextBatch = TRUE;
 512        if (have_posts()): while (have_posts()): the_post();
 513            $NewSecStrtTag = ($TotalPosts < $PostBatch || $i == 1 || $EndingTagAppended === TRUE) ? $StrtingTag : '';
 514            if (!empty($NewSecStrtTag) && $NextBatch === TRUE) {
 515                $ImageSize = '370x491';
 516                $NextBatch = FALSE;
 517                $AlterStyle = TRUE;
 518            } else if (!empty($NewSecStrtTag) && $NextBatch === FALSE) {
 519                $ImageSize = '370x252';
 520                $NextBatch = TRUE;
 521                $AlterStyle = FALSE;
 522            } else if (empty($NewSecStrtTag) && $AlterStyle === TRUE) {
 523                $ImageSize = '370x252';
 524                $AlterStyle = FALSE;
 525            } else if (empty($NewSecStrtTag) && $AlterStyle === FALSE) {
 526                $ImageSize = '370x491';
 527                $AlterStyle = TRUE;
 528            }
 529            $NewSecCloseTag = ($i == $TotalPosts || ($TotalPosts < $PostBatch && $i == $TotalPosts) || ($i % $PostBatch == 0 && $i !== 1)) ? $CloseTag : '';
 530            $EndingTagAppended = ($i == $TotalPosts || ($TotalPosts < $PostBatch && $i == $TotalPosts) || ($i % $PostBatch == 0 && $i !== 1)) ? TRUE : FALSE;
 531            $Cause .= $NewSecStrtTag .
 532                '<div class="portfolio" data-cat="' . $i . '"> 
 533				      <a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_ID(), $ImageSize) . '</a>
 534					  <div class="port-desc">
 535						<h4><a href="' . get_permalink() . '" title="' . get_the_title() . '">' . sh_excerpt(get_the_title(), 40) . '</a></h4>
 536						<p>' . sh_excerpt(get_the_content(), 300) . '</p>
 537					  </div>
 538				   </div>'
 539                . $NewSecCloseTag;
 540            $i++;
 541        endwhile;
 542        endif;
 543        wp_reset_query();
 544        $output = '';        
 545        $output .= '
 546					<div id="Grid">
 547					  <div class="row">
 548						' . $Cause . '
 549					  </div>
 550					</div>';
 551        
 552        return $output;
 553    }
 554    function donation($atts, $content = null)
 555    {
 556        extract(shortcode_atts(array(
 557            'title' => 'Donate Us',
 558            'heading_style' => 'simple',
 559            
 560        ), $atts));
 561        $paypal = $GLOBALS['_sh_base']->donation;
 562        
 563        $donation_data = get_option(SH_NAME);
 564        $output = '';
 565        $output .= '<div class="pull-right">';
 566        
 567        $output .= '
 568					 <div class="donate-us-box">
 569					   <h5>' . __('Give Your Donations', SH_NAME) . '</h5>
 570					   <span>' . __('Donation Needed', SH_NAME) . '</span> <span class="amount-figures"><strong>' . sh_set($donation_data, 'paypal_currency') . '</strong> 
 571					   ' . sh_set($donation_data, 'paypal_target') . '!</span> <span>' . __('Collection Donation', SH_NAME) . '</span> 
 572					   <span class="amount-figures coloured"><strong>' . sh_set($donation_data, 'paypal_currency') . '</strong> 
 573					   ' . sh_set($donation_data, 'paypal_raised') . '!</span> <span class="cell"><i class="icon-phone"></i>
 574					   ' . sh_set($donation_data, 'paypal_contact') . '</span> 
 575					 <a  data-toggle="modal" data-target="#myModal"  class="donate-btn" title="">Donate Us</a>
 576					 </div>
 577				   </div>';
 578        return $output;
 579    }
 580    function donation_2($atts, $content = null)
 581    {
 582        extract(shortcode_atts(array(
 583            
 584        ), $atts));
 585        $paypal = $GLOBALS['_sh_base']->donation;
 586        $paypal_res = '';
 587        $single_page = (sh_set($_SESSION, 'sh_causes_page')) ? sh_set($_SESSION, 'sh_causes_page') : false;
 588        if ($single_page == true) unset($_SESSION['sh_causes_page']);
 589        if (isset($_GET['recurring_pp_return']) && $_GET['recurring_pp_return'] == 'return') {
 590            $paypal_res = require_once(get_template_directory() . '/framework/modules/pp_recurring/review.php');
 591        }
 592        
 593        $donation_data = get_option(SH_NAME);
 594        if ($notif = $paypal->_paypal->handleNotification()) $paypal_res = $paypal->single_pament_result($notif);
 595        $return_url = (is_home()) ? home_url() : get_permalink();
 596        $percent = (sh_set($donation_data, 'paypal_target')) ? (int)str_replace(',', '', sh_set($donation_data, 'paypal_raised')) / (int)str_replace(',', '', sh_set($donation_data, 'paypal_target')) : 0;
 597        $donation_percentage = $percent * 100;
 598        $symbol = (sh_set($donation_data, 'paypal_currency')) ? sh_set($donation_data, 'paypal_currency') : '$';
 599        $output = '';
 600        
 601        $output .= '<div class="donation-bar">
 602					  <div class="amount pull-left">
 603						<p>' . __('Dontaions Needed', SH_NAME) . '</p>
 604						<span><strong>' . sh_set($donation_data, 'paypal_currency') . '</strong> ' . sh_set($donation_data, 'paypal_target') . '!</span> </div>
 605					  <div class="donate-now">';
 606        if (sh_set($donation_data, 'donate_method') == 'true') {
 607            $output .= '<a  data-toggle="modal" data-target="#myModal"  class="donate-btn" title="">Donate Us</a>';
 608        } else {
 609            $output .= $paypal->button(array('currency_code' => sh_set($donation_data, 'paypal_currency_code'), 'item_name' => get_bloginfo('name'), 'return' => $return_url));
 610        }
 611        $output .= '</div>
 612					  <div class="amount pull-right">
 613						<p>' . __('Collected Donations', SH_NAME) . '</p>
 614						<span><strong>' . sh_set($donation_data, 'paypal_currency') . '</strong> ' . sh_set($donation_data, 'paypal_raised') . '!</span> 
 615					  </div>
 616				   </div>';
 617        
 618        $output .= '<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">';
 619        if (isset($_GET['recurring_pp_return']) && $_GET['recurring_pp_return'] == 'return') {
 620            $output .= '<div class="donate-popup">' . $paypal_res . '</div>';
 621            $output .= '<script>
 622								jQuery(document).ready(function($){
 623									$(".donation-bar a.donate-btn").trigger("click");
 624								
 625								});
 626						</script>';
 627        } elseif ($notif = $paypal->_paypal->handleNotification() && isset($notif->ok)) {
 628            $output .= '<div class="donate-popup">' . $paypal_res . '</div>';
 629            $output .= '<script>
 630								jQuery(document).ready(function($){
 631									$(".donation-bar a.donate-btn").trigger("click");
 632								
 633								});
 634						</script>';
 635        } else {
 636            $output .= '<div class="donate-popup">
 637		<div class="cause-bar">
 638			<div class="cause-box"><h3><span>' . $symbol . '</span>' . sh_set($donation_data, 'paypal_target') . '</h3><i>' . __('NEEDED DONATION', SH_NAME) . '</i></div>
 639			<div class="cause-progress">
 640					<div class="progress-report">
 641					<h6>' . __('PHASES', SH_NAME) . '</h6>
 642					<span>' . $donation_percentage . '%</span>
 643					<div class="progress pattern">
 644						<div class="progress-bar" style="width: ' . $donation_percentage . '%"></div>
 645					</div>
 646				</div>
 647			</div>
 648			<div class="cause-box"><h3><span>' . $symbol . '</span>' . sh_set($donation_data, 'paypal_raised') . '</h3><i>' . __('COLLECTED DONATION', SH_NAME) . '</i></div>
 649			<div class="cause-box donate-drop-btn"><h4>' . __('DONATE NOW', SH_NAME) . '</h4></div>
 650		</div>
 651		<div class="donate-drop-down">
 652			<div class="recursive-periods">';
 653				$Settings = get_option(SH_NAME); 
 654				$value = sh_set($Settings , 'transactions_detail');
 655					if($value)
 656					{
 657						foreach($value as $val )
 658						{
 659							$txt = ucwords(str_replace('_', ' ', $val));
 660							$output .= '<a style="cursor:pointer;">'.__( $txt, SH_NAME ).'</a>';
 661						}
 662					}
 663			$output .='</div>
 664			<div class="amount-btns">';
 665					if( intval ( sh_set($Settings , 'pop_up_1st_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_1st_value').'</span></a>';
 666				if(intval ( sh_set($Settings , 'pop_up_2nd_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_2nd_value').'</span></a>';
 667				if(intval ( sh_set($Settings , 'pop_up_3rd_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_3rd_value').'</span></a>';
 668				if(intval ( sh_set($Settings , 'pop_up_4th_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_4th_value').'</span></a>';
 669				if(intval ( sh_set($Settings , 'pop_up_5th_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_5th_value').'</span></a>';
 670			$output .= '</div>';
 671            $output .= '<div class="other-amount">
 672					' . $paypal->button(array('item_name' => get_bloginfo('name'), 'amount' => 30, 'return' => $return_url)) . '
 673				</div>';
 674            if (!is_user_logged_in()) {
 675                $output .= '<form id="login" action="" method="post">
 676						<h1>Please Login OR Register first to make recursive donation</h1>
 677						<p class="status"></p>
 678						<label for="username">Username</label>
 679						<input id="username" type="text" name="username">
 680						<label for="password">Password</label>
 681						<input id="password" type="password" name="password">
 682						<a class="lost" href="' . wp_registration_url() . '">Register Now</a>
 683						<input class="submit_button" type="submit" value="Login" name="submit">
 684						<a class="close" href="">(close)</a>
 685						' . wp_nonce_field('ajax-login-nonce', 'security') . '
 686					</form>';
 687            }
 688            $output .= '</div>
 689				</div>';
 690        }
 691        $output .= '</div>';
 692        return $output;
 693    }
 694    function donation_3($atts, $content = null)
 695    {
 696        extract(shortcode_atts(array(
 697            'title' => '',
 698            
 699        ), $atts));
 700        $paypal_res = '';
 701        $single_page = (sh_set($_SESSION, 'sh_causes_page')) ? sh_set($_SESSION, 'sh_causes_page') : false;
 702        if ($single_page == true) unset($_SESSION['sh_causes_page']);
 703        if (isset($_GET['recurring_pp_return']) && $_GET['recurring_pp_return'] == 'return') {
 704            $paypal_res = require_once(get_template_directory() . '/framework/modules/pp_recurring/review.php');
 705        }
 706        $paypal = $GLOBALS['_sh_base']->donation;
 707        if ($notif = $paypal->_paypal->handleNotification()) $paypal_res = $paypal->single_pament_result($notif);
 708        $return_url = (is_home()) ? home_url() : get_permalink();
 709        
 710        $donation_data = get_option(SH_NAME);
 711        $percent = (sh_set($donation_data, 'paypal_target')) ? (int)str_replace(',', '', sh_set($donation_data, 'paypal_raised')) / (int)str_replace(',', '', sh_set($donation_data, 'paypal_target')) : 0;
 712        $donation_percentage = $percent * 100;
 713        $symbol = (sh_set($donation_data, 'paypal_currency')) ? sh_set($donation_data, 'paypal_currency') : '$';
 714        $output = '';
 715        
 716        $output .= '<div class="donate-us">
 717					  <h3>' . sh_character_limit(20, $title) . '</h3>
 718					  <span><i class="icon-phone"></i>' . sh_set($donation_data, 'paypal_contact') . '</span>
 719					  <div class="collected">
 720						<p>' . __('Collected Dontaions', SH_NAME) . '</p>
 721						<span><strong>' . sh_set($donation_data, 'paypal_currency') . '</strong> ' . sh_set($donation_data, 'paypal_raised') . '!</span> </div>
 722					  <div class="d-now">';
 723        if (sh_set($donation_data, 'donate_method') == 'true') {
 724            $output .= '<a  data-toggle="modal" data-target="#myModal"  class="donate-btn" title="">Donate Us</a>';
 725        } else {
 726            $output .= $paypal->button(array('currency_code' => sh_set($donation_data, 'paypal_currency_code'), 'item_name' => get_bloginfo('name'), 'return' => $return_url));
 727        }
 728        $output .= '</div>
 729				  </div>';
 730        
 731        $output .= '<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">';
 732        if (isset($_GET['recurring_pp_return']) && $_GET['recurring_pp_return'] == 'return') {
 733            $output .= '<div class="donate-popup">' . $paypal_res . '</div>';
 734            $output .= '<script>
 735								jQuery(document).ready(function($){
 736									$(".donate-us a.donate-btn").trigger("click");
 737								
 738								});
 739						</script>';
 740        } elseif ($notif = $paypal->_paypal->handleNotification() && isset($notif->ok)) {
 741            $output .= '<div class="donate-popup">' . $paypal_res . '</div>';
 742            $output .= '<script>
 743								jQuery(document).ready(function($){
 744									$(".donate-us a.donate-btn").trigger("click");
 745								
 746								});
 747						</script>';
 748        } else {
 749            $output .= '<div class="donate-popup">
 750		<div class="cause-bar">
 751			<div class="cause-box"><h3><span>' . $symbol . '</span>' . sh_set($donation_data, 'paypal_target') . '</h3><i>' . __('NEEDED DONATION', SH_NAME) . '</i></div>
 752			<div class="cause-progress">
 753					<div class="progress-report">
 754					<h6>' . __('PHASES', SH_NAME) . '</h6>
 755					<span>' . $donation_percentage . '%</span>
 756					<div class="progress pattern">
 757						<div class="progress-bar" style="width: ' . $donation_percentage . '%"></div>
 758					</div>
 759				</div>
 760			</div>
 761			<div class="cause-box"><h3><span>' . $symbol . '</span>' . sh_set($donation_data, 'paypal_raised') . '</h3><i>' . __('COLLECTED DONATION', SH_NAME) . '</i></div>
 762			<div class="cause-box donate-drop-btn"><h4>' . __('DONATE NOW', SH_NAME) . '</h4></div>
 763		</div>
 764		<div class="donate-drop-down">
 765			<div class="recursive-periods">';
 766			$Settings = get_option(SH_NAME); 
 767			$value = sh_set($Settings , 'transactions_detail');
 768				if($value)
 769				{
 770					foreach($value as $val )
 771					{
 772						$txt = ucwords(str_replace('_', ' ', $val));
 773						$output .= '<a style="cursor:pointer;">'.__( $txt, SH_NAME ).'</a>';
 774					}
 775				}
 776			$output .= '</div>
 777			<div class="amount-btns">';
 778				if( intval ( sh_set($Settings , 'pop_up_1st_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_1st_value').'</span></a>';
 779				if(intval ( sh_set($Settings , 'pop_up_2nd_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_2nd_value').'</span></a>';
 780				if(intval ( sh_set($Settings , 'pop_up_3rd_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_3rd_value').'</span></a>';
 781				if(intval ( sh_set($Settings , 'pop_up_4th_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_4th_value').'</span></a>';
 782				if(intval ( sh_set($Settings , 'pop_up_5th_value') ) != '') $output .= '<a style="cursor:pointer;">'.$symbol.'<span>'.sh_set($Settings , 'pop_up_5th_value').'</span></a>';
 783			$output .= '</div>';
 784            $output .= '<div class="other-amount">
 785					' . $paypal->button(array('item_name' => get_bloginfo('name'), 'amount' => 30, 'return' => $return_url)) . '
 786				</div>';
 787            if (!is_user_logged_in()) {
 788                $output .= '<form id="login" action="" method="post">
 789						<h1>Please Login OR Register first to make recursive donation</h1>
 790						<p class="status"></p>
 791						<label for="username">Username</label>
 792						<input id="username" type="text" name="username">
 793						<label for="password">Password</label>
 794						<input id="password" type="password" name="password">
 795						<a class="lost" href="' . wp_registration_url() . '">Register Now</a>
 796						<input class="submit_button" type="submit" value="Login" name="submit">
 797						<a class="close" href="">(close)</a>
 798						' . wp_nonce_field('ajax-login-nonce', 'security') . '
 799					</form>';
 800            }
 801            $output .= '</div>
 802				</div>';
 803        }
 804        $output .= '</div>';
 805        return $output;
 806    }
 807    function start_regular_donation($atts, $content = null)
 808    {
 809        extract(shortcode_atts(array(
 810            'title' => '',
 811            'sub_title' => '',
 812            'image' => '',
 813            'currency' => '$',
 814            'donation_needed' => '',
 815            'link_caption' => '',
 816            'text' => '',
 817            'heading_style' => 'simple',
 818            
 819        ), $atts));
 820        
 821        $title = sh_character_limit(25, $title);
 822        $SubTitle = (!empty($sub_title)) ? '<h5>' . sh_character_limit(26, $sub_title) . '</h5>' : '';
 823        $DonationNeeded = (!empty($donation_needed) || !empty($currency)) ? '<span>' . $currency . $donation_needed . ' </span>' : '';
 824        $output = '';
 825        
 826        
 827        $output .= '
 828					  <div class="donate-message">
 829					    ' . wp_get_attachment_image($image, '270x155') . '
 830						' . $SubTitle . '
 831						<p>' . $DonationNeeded . sh_character_limit(100, $text) . '</p>
 832						<a href="" title="">' . sh_character_limit(25, $link_caption) . '</a> 
 833					  </div>
 834				   ';
 835        
 836        return $output;
 837    }
 838    function ceo_message($atts, $content = null)
 839    {
 840        extract(shortcode_atts(array(
 841                'number' => '',
 842                'category' => '',
 843                'sort_by' => 'date',
 844                'sorting_order' => 'ASC',
 845				'overlap' =>	'',
 846            ), $atts)
 847        );
 848        $args = array('post_type' => 'dict_testimonials', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order);
 849        if ($category != '') $args['tax_query'] = array(array('taxonomy' => 'testimonial_category', 'field' => 'id', 'terms' => $category));
 850        //$Query = 'post_type=dict_testimonials&posts_per_page='.$number.'&orderby='.$sort_by.'&order='.$sorting_order;
 851        //$Query .= (!empty( $category ) ) ? '&testimonial_category='.$category: '';
 852        $Posts = query_posts($args);
 853        $i = 1;
 854        $Message = $MessageNav = '';
 855        if (have_posts()): while (have_posts()): the_post();
 856            $Settings = get_post_meta(get_the_ID(), '_dict_testimonials_settings', true);
 857            $Message .= '<li>
 858						<div class="carusal-image-thumb"> 
 859							' . get_the_post_thumbnail(get_the_ID(), '150x150') . ' 
 860							<strong>' . sh_set($Settings, 'name') . ',</strong>
 861							<span class="carusal-image-thumb-name"> ' . sh_set($Settings, 'designation') . ' </span> 
 862						</div>
 863						<p>' . get_the_content() . '</p></a>
 864					 </li>';
 865            $i++;
 866        endwhile;
 867        endif;
 868        wp_reset_query();
 869		$output = '';
 870        $output .= '<div class="testimonial';
 871		if( $overlap == 'true' ): $output .= ' overlap'; endif;
 872		$output .= '">
 873			<div class="slideshow">
 874				<ul class="slides">
 875				  ' . $Message . '
 876				</ul>
 877			  </div>
 878		</div>
 879<script>
 880jQuery(document).ready(function($){
 881if( $(\'.slideshow\').length ){
 882		$(\'.slideshow\').flexslider({
 883			animation: "fade",
 884			animationLoop: false,
 885			slideShow:false,
 886			controlNav: true,	
 887			maxItems: 1,
 888			pausePlay: false,
 889			mousewheel:false,
 890			start: function(slider){
 891			  $(\'body\').removeClass(\'loading\');
 892			}
 893		});
 894	}
 895});
 896</script>';
 897        return $output;
 898    }
 899    /*function recent_news( $atts, $content = null )
 900	{
 901		extract( shortcode_atts( array( 
 902			'number' => '', 
 903			'title' => __('Recent News', SH_NAME), 
 904			'category' => '', 
 905			'sort_by' => 'date', 
 906			'sorting_order' => 'DESC',
 907			'heading_style' => 'simple' ,
 908			'margins' =>'' ), $atts ) 
 909		);
 910		$marginsarr = explode(',' , $margins);
 911		
 912		$News = $Thumb = '';
 913		wp_reset_query();
 914		$args = array('post_type' => 'post' , 'posts_per_page'=> $number , 'orderby' => $sort_by , 'order' => $sorting_order, 'category' => $category);
 915		//if($category != '') $args['category'] = array($category);
 916		
 917		$query = new WP_Query($args);
 918		//printr($query);
 919		
 920		$i = 1;
 921		
 922		if( $query->have_posts()): while( $query->have_posts() ): $query->the_post();
 923		
 924		$Settings = get_post_meta( get_the_ID(), '_post_settings', true );
 925		
 926		if( $video_link = sh_set( $Settings, 'video_link' ) )
 927		{
 928			$opt = get_post_meta( get_the_ID(), '_dictate_gal_videos', true );
 929			$video_data = sh_grab_video( $video_link, $opt );
 930			
 931			$PostMedia = '<div class="image"> 
 932							  <img src="'.sh_set( $video_data, 'thumb').'" style="width:261px; height:207px;" alt="'.sh_set( $video_data, 'title' ).'" /> 
 933							  <a class="html5lightbox" rel="prettyPhoto" href="'.$video_link.'" title="'.sh_set( $video_data, 'title' ).'"> 
 934								  <span><i class="icon-play"></i></span> 
 935							  </a> 
 936						  </div>';
 937			$CarouselThumb = '<img src="'.sh_set( $video_data, 'thumb').'" style="width:131px; height:78px;" alt="'.sh_set( $video_data, 'title' ).'" />';
 938		}
 939		else
 940		{
 941			$PostAttchment = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'large' );
 942			$PostMedia = '<div class="image">
 943							  '.get_the_post_thumbnail( get_the_ID(), '370x252' ).'
 944							  <a title="" href="'.sh_set( $PostAttchment, 0 ).'" rel="prettyPhoto" class="html5lightbox"><i class="icon-picture"></i></a>
 945						  </div>';
 946			$CarouselThumb = get_the_post_thumbnail( get_the_ID(), '270x155' );
 947		}
 948		
 949		$News .= '<div id="news'.$i.'">
 950					<div class="row">
 951						<div class="col-md-6 desc">
 952						  <h3><a href="'.get_permalink().'" title="">'.sh_character_limit( 35, get_the_title() ).'</a></h3>
 953						  <p>'.sh_character_limit( 340, get_the_content() ).'</p>
 954						</div>
 955						<div class="col-md-6">
 956							'.$PostMedia.'
 957						</div>
 958					</div>
 959				  </div>';
 960		$Thumb .= '<a href="#news'.$i.'">'.$CarouselThumb.'<span class="carusal-our-news">'.sh_character_limit( 17, get_the_title() ).'</span></a>';
 961		$i++;
 962		endwhile; 
 963		endif;
 964		wp_reset_query();
 965		wp_enqueue_script('carofredcsel');
 966		$output = '' ;
 967		$output.= ( in_array('top' , (array)$marginsarr)) ? '<div class="block"></div>' : ''; 
 968		$output .= ($heading_style == 'underline')? '<div class="sec-heading">
 969					'.sh_get_title( $title, 'h2', 'strong', TRUE ).'
 970				  </div>' : '' ;
 971		$output .= ($heading_style == 'modern')? '<div class="sec-title">
 972							'.sh_get_title( $title, 'h1', 'span', FALSE ).'
 973						</div>' : '' ;
 974		$output .= ($heading_style == 'simple')? '<div class="sec-heading2">
 975					'.sh_get_title( $title, 'h2', 'strong', TRUE ).'
 976				  </div>' : '' ;
 977		
 978		$output .= '<div class="carusal-slider">
 979					  <div id="carousel-wrapper">
 980						<div id="carousel">
 981						  '.$News.' 
 982						</div>
 983					  </div>
 984					  <div id="thumbs-wrapper">
 985						<div id="thumbs">'.$Thumb.'</div>
 986						<a id="prev" href="#"><i class="icon-angle-left"></i></a> <a id="next" href="#"><i class="icon-angle-right"></i></a> </div>
 987					</div>
 988					<script>
 989					jQuery(document).ready(function($){
 990						 $(\'#carousel\').carouFredSel({
 991						  responsive: true,
 992						  circular: false,
 993						  auto: false,
 994						  items: {
 995						   visible: 1,
 996						   width: 20,
 997						  },
 998						  scroll: {
 999						   fx: \'directscroll\'
1000						  }
1001						 });
1002						 $(\'#thumbs\').carouFredSel({
1003						  responsive: true,
1004						  circular: false,
1005						  infinite: false,
1006						  auto: false,
1007						  prev: \'#prev\',
1008						  next: \'#next\',
1009						  items: {
1010						   visible: {
1011							min: 1,
1012							max: 6
1013						   },
1014						   width: 200,
1015						   height: \'80%\'
1016						  }
1017						 });
1018						 $(\'#thumbs a\').click(function() {
1019						  $(\'#carousel\').trigger(\'slideTo\', \'#\' + this.href.split(\'#\').pop() );
1020						  $(\'#thumbs a\').removeClass(\'selected\');
1021						  $(this).addClass(\'selected\');
1022						  return false;
1023						 });
1024					});
1025					</script>
1026					';
1027		$output.= ( in_array('bottom' , (array)$marginsarr)) ? '<div class="block"></div>' : ''; 
1028		return $output ;
1029	}
1030	*/
1031    function recent_events($atts, $content = null)
1032    {
1033        extract(shortcode_atts(array(
1034                'title' => 'Recent Events',
1035                'number' => '',
1036                'category' => '',
1037                'sort_by' => 'date',
1038                'sorting_order' => 'ASC',
1039                'heading_style' => 'simple',
1040                ), $atts)
1041        );
1042        
1043        $args = array('post_type' => 'dict_event', 'posts_per_page' => $number, 'orderby' => $sort_by, 'order' => $sorting_order);
1044        if ($category) $args['tax_query'] = array(array('taxonomy' => 'event_category', 'field' => 'id', 'terms' => $category));
1045        query_posts($args);
1046        $Events = '';
1047        $i = 1;
1048        if (have_posts()): while (have_posts()): the_post();
1049            $Settings = get_post_meta(get_the_ID(), '_dict_event_settings', true);
1050            $PostThumbSize1 = ($i == 1) ? 'style="width:570px; height:184px;"' : 'style="width:100px; height:100px;"';
1051            $PostThumbSize2 = ($i == 1) ? '570x220' : '150x150';
1052            $EventOrganizer = ($i == 1 && sh_set($Settings, 'organizer')) ? '<li><a href="#" title=""><i class="icon-user"></i>' . __('by', SH_NAME) . ' ' . sh_set($Settings, 'organizer') . '</a></li>' : '';
1053            $EventdateDetails = '';
1054            if (sh_set($Settings, 'video_link')) {
1055                $video_link = sh_set($Settings, 'video_link');
1056                $video_data = sh_grab_video($video_link, $Settings);
1057                $PostMedia = '<div class="carou-post-img">
1058							  <img src="' . sh_set($video_data, 'thumb') . '" ' . $PostThumbSize1 . '  alt="' . sh_set($video_data, 'title') . '" />
1059							  <a title="' . sh_set($video_data, 'title') . '" href="' . $video_link . '" class="html5lightbox"><i class="icon-play"></i></a>
1060						  </div>';
1061            } else {
1062                //$PostMedia = get_the_post_thumbnail( get_the_ID(), $PostThumbSize );
1063                $PostAttchment = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'large');
1064                $PostMedia = '<div class="carou-post-img">
1065							  ' . get_the_post_thumbnail(get_the_ID(), $PostThumbSize2) . '
1066							  <a title="" href="' . sh_set($PostAttchment, 0) . '" class="html5lightbox"><i class="icon-picture"></i></a>
1067						  </div>';
1068            }
1069            if (!empty($Settings['start_date'])) {
1070                $Eventdate = new DateTime($Settings['start_date']);
1071                $EventdateDetails = '<li><a href="' . get_permalink() . '" title=""><i class="icon-calendar-empty"></i><span>' . $Eventdate->format('F') . '</span> ' . $Eventdate->format('d, Y') . '</a></li>';
1072            } else if (!empty($Settings['end_date'])) {
1073                $Eventdate = new DateTime($Settings['end_date']);
1074                $EventdateDetails = '<li><a href="' . get_permalink() . '" title=""><i class="icon-calendar-empty"></i><span>' . $Eventdate->format('F') . '</span> ' . $Eventdate->format('d, Y') . '</a></li>';
1075            }
1076            $Class = ($i == 1) ? 'recent-event' : 'recent-event  previous-event';
1077            $md_class = ($i == 1) ? 'col-md-12' : 'col-md-6';
1078            $Location = (sh_set($Settings, 'location')) ? '<li><a href="' . get_permalink() . '" title=""><i class="icon-map-marker"></i>in ' . sh_set($Settings, 'location') . '</a></li>' : '';
1079            $TitleLength = ($i == 1) ? 35 : 20;
1080            $Events .= '<div class="' . $md_class . '">
1081						<div class="' . $Class . '">
1082						  <div class="recent-event-img">…

Large files files are truncated, but you can click here to view the full file