PageRenderTime 182ms CodeModel.GetById 95ms app.highlight 62ms RepoModel.GetById 2ms app.codeStats 1ms

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

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

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