function render($atts, $content = null) { $this->block_uid = td_global::td_generate_unique_id(); //update unique id on each render $buffy = ''; //output buffer extract(shortcode_atts(array('limit' => 4, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'tag_slug' => '', 'force_columns' => '', 'autoplay' => '', 'offset' => 0), $atts)); if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block } if ($td_column_number == 3) { $current_limit = intval($limit); $post_limit = constant(get_class($this->internal_block_instance) . '::POST_LIMIT'); $td_query = td_data_source::get_wp_query($atts); if (!empty($td_query->posts)) { if ($current_limit > $post_limit and count($td_query->posts) > $post_limit) { $buffy .= '<div class="td-big-grid-slide td_block_wrap" id="iosSlider_' . $this->block_uid . '">'; $buffy .= '<div class="td-theme-slider td_block_inner" id="' . $this->block_uid . '">'; $current_offset = 0; $atts['class'] = 'item'; while ($current_limit > 0) { $atts['offset'] = $offset + $current_offset; $buffy .= $this->internal_block_instance->render($atts); $current_offset += $post_limit; $current_limit -= $post_limit; } $buffy .= '</div>'; //end slider (if slider) $buffy .= '<i class = "td-icon-left"></i>'; $buffy .= '<i class = "td-icon-right"></i>'; $buffy .= '</div>'; //end iosSlider (if slider) $autoplay_settings = ''; $current_autoplay = filter_var($autoplay, FILTER_VALIDATE_INT); if ($current_autoplay !== false) { $autoplay_settings = 'autoSlide: true, autoSlideTimer: ' . $current_autoplay * 1000 . ','; } $slide_javascript = ';jQuery(document).ready(function() { jQuery("#iosSlider_' . $this->block_uid . '").iosSlider({ snapToChildren: true, desktopClickDrag: true, keyboardControls: true, responsiveSlides: true, infiniteSlider: true, ' . $autoplay_settings . ' navPrevSelector: jQuery("#iosSlider_' . $this->block_uid . ' .td-icon-left"), navNextSelector: jQuery("#iosSlider_' . $this->block_uid . ' .td-icon-right") }); });'; td_js_buffer::add_to_footer($slide_javascript); } else { $buffy .= $this->internal_block_instance->render($atts); } } } return $buffy; }
/** * Used by all the shortcodes + widget to render the weather. The top bar has a separate function bellow * @param $atts * @param $block_uid * @param $template string -> block_template | top_bar_template * @return string */ static function render_generic($atts, $block_uid, $template = 'block_template') { if (empty($atts['w_location'])) { return self::error('<strong>location</strong> is empty. Configure this block/widget and enter a location and we will show the weather from that location :) '); } $current_unit = 0; // 0 - metric $current_temp_label = 'C'; $current_speed_label = 'kmh'; if (!empty($atts['w_units'])) { $current_unit = 1; // imperial $current_temp_label = 'F'; $current_speed_label = 'mph'; } // prepare the data and do an api call $weather_data = array('block_uid' => '', 'api_location' => $atts['w_location'], 'api_language' => '', 'api_key' => self::get_a_owm_key(), 'today_icon' => '', 'today_icon_text' => '', 'today_temp' => array(0, 0), 'today_humidity' => '', 'today_wind_speed' => array(0, 0), 'today_min' => array(0, 0), 'today_max' => array(0, 0), 'today_clouds' => 0, 'current_unit' => $current_unit, 'forecast' => array()); // disable the cache for debugging // td_remote_cache::_disable_cache(); $weather_data_status = self::get_weather_data($atts, $weather_data); // check if we have an error and return that if ($weather_data_status != 'api_fail_cache' and $weather_data_status != 'api' and $weather_data_status != 'cache') { return $weather_data_status; } // we have to patch the cached data - to make sure we have the REAL block_uid that is now on the page $weather_data['block_uid'] = $block_uid; // render the HTML $buffy = '<!-- td weather source: ' . $weather_data_status . ' -->'; if ($template == 'block_template') { // renders the block template $buffy .= self::render_block_template($atts, $weather_data, $current_temp_label, $current_speed_label); } else { // render the top menu template $buffy .= self::render_top_bar_template($atts, $weather_data, $current_temp_label); } // render the JS ob_start(); ?> <script> jQuery().ready(function() { tdWeather.items.push(<?php echo json_encode($weather_data); ?> ); }); </script> <?php $script_buffer = ob_get_clean(); $js_script = "\n" . td_util::remove_script_tag($script_buffer); td_js_buffer::add_to_footer($js_script); return $buffy; }
function __construct($background_parameters) { // save a local copy $this->background_parameters = $background_parameters; // bg click ad td_js_buffer::add_variable('td_ad_background_click_link', stripslashes($this->background_parameters['td_ad_background_click_link'])); // the slashes are added by wp in the panel submit td_js_buffer::add_variable('td_ad_background_click_target', $this->background_parameters['td_ad_background_click_target']); // add the css if needed - the css knows about the stretched background! if ($this->background_parameters['theme_bg_image'] != '' or $this->background_parameters['theme_bg_color'] != '') { td_css_buffer::add_to_header($this->add_css_custom_background()); } // add the js if needed - needed only for stretch background if (!empty($this->background_parameters['theme_bg_image']) and $this->background_parameters['is_stretched_bg'] == true) { td_js_buffer::add_to_footer($this->add_js_hook()); } // here we manipulate the body_class-es, we remove the WordPress ones and add our own + boxed version class add_filter('body_class', array($this, 'add_slug_to_body_class')); }
function render($atts) { $this->block_uid = td_global::td_generate_unique_id(); //update unique id on each render //global $post; extract(shortcode_atts(array('limit' => 4, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'tag_slug' => '', 'force_columns' => '', 'autoplay' => ''), $atts)); //echo $atts['limit']; //$atts['limit'] = 4;//set 4 to remove the slide $buffy = ''; //output buffer $id_slider = ''; $class_iosSlider = ''; $this->td_create_slider = 0; //if there are more then 4 images then make big grid a slide if ($atts['limit'] > 4) { $this->td_create_slider = 1; $id_slider = 'id="iosSlider_' . $this->block_uid . '"'; $class_iosSlider = 'iosSlider'; } $buffy .= '<div class="' . $class_iosSlider . ' td_block_wrap td_block_big_grid" ' . $id_slider . '>'; $buffy .= '<div class="slider td_block_inner" id="' . $this->block_uid . '">'; //do the query $td_query = td_data_source::get_wp_query($atts); //by ref do the query //get the js for this block - last parm is block id $buffy .= $this->get_block_js($atts, $td_query); //$buffy .= '<div class="td_block_wrap td_block_big_grid">'; //get the sub category filter for this block $buffy .= $this->get_block_sub_cats($atts); //$buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">'; //inner content of the block $buffy .= $this->inner($td_query->posts, $force_columns); //$buffy .= '</div>'; //$buffy .= '</div> <!-- ./td_block_big_grid -->'; $buffy .= '</div>'; //end slider (if slider) if ($this->td_create_slider == 1) { $buffy .= '<i class = "td-icon-left"></i>'; $buffy .= '<i class = "td-icon-right"></i>'; } $buffy .= '</div>'; //end iosSlider (if slider) //close the ios slider wrappers if ($this->td_create_slider == 1) { //autoplay option for $autoplay_string = ''; if (!empty($autoplay)) { $autoplay_string = 'autoSlide: true, autoSlideTimer: ' . $autoplay * 1000 . ','; } $slide_javascript = ' jQuery(document).ready(function() { jQuery("#iosSlider_' . $this->block_uid . '").iosSlider({ snapToChildren: true, desktopClickDrag: true, keyboardControls: false, responsiveSlides: true, infiniteSlider: true, ' . $autoplay_string . ' navPrevSelector: jQuery("#iosSlider_' . $this->block_uid . ' .td-icon-left"), navNextSelector: jQuery("#iosSlider_' . $this->block_uid . ' .td-icon-right"), onSliderLoaded : td_resize_page_sliders, onSliderResize : td_resize_big_grid_update_vars_' . $this->block_uid . ',//td_resize_slide, onSlideChange : td_resize_slide }); }); /* * Resize the iosSlider when the page is resided (fixes bug on Android devices) * For big grid the code runs on all devices because the big slider changes its height * and we change the td_resize_slide function with this one */ function td_resize_big_grid_update_vars_' . $this->block_uid . '(args) { //if(tdDetect.isAndroid) { setTimeout(function(){ jQuery("#iosSlider_' . $this->block_uid . '").iosSlider("update"); }, 1000); //} } '; td_js_buffer::add_to_footer($slide_javascript); } return $buffy; }
/** * @param $posts * @param string $td_column_number - get the column number * @param string $autoplay - not use via ajax * @param bool $is_ajax - if true the script will return the js inline, if not, it will use the td_js_buffer class * @return string */ function inner($posts, $td_column_number = '', $autoplay = '', $is_ajax = false) { $buffy = ''; $td_block_layout = new td_block_layout(); if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block from the page builder API } $td_post_count = 0; // the number of posts rendered $td_unique_id_slide = td_global::td_generate_unique_id(); //@generic class for sliders : td-theme-slider $buffy .= '<div id="' . $td_unique_id_slide . '" class="td-theme-slider iosSlider-col-' . $td_column_number . ' td_mod_wrap">'; $buffy .= '<div class="td-slider ">'; if (!empty($posts)) { foreach ($posts as $post) { //$buffy .= td_modules::mod_slide_render($post, $td_column_number, $td_post_count); $td_module_slide = new td_module_slide($post); $buffy .= $td_module_slide->render($td_column_number, $td_post_count, $td_unique_id_slide); $td_post_count++; } } $buffy .= $td_block_layout->close_all_tags(); $buffy .= '</div>'; //close slider $buffy .= '<i class = "td-icon-left prevButton"></i>'; $buffy .= '<i class = "td-icon-right nextButton"></i>'; $buffy .= '</div>'; //close ios if (!empty($autoplay)) { $autoplay_string = ' autoSlide: true, autoSlideTimer: ' . $autoplay * 1000 . ', '; } else { $autoplay_string = ''; } //add resize events //$add_js_resize = ''; //if($td_column_number > 1) { $add_js_resize = ', //onSliderLoaded : td_resize_normal_slide, //onSliderResize : td_resize_normal_slide_and_update'; //} $slide_js = ' jQuery(document).ready(function() { jQuery("#' . $td_unique_id_slide . '").iosSlider({ snapToChildren: true, desktopClickDrag: true, keyboardControls: false, responsiveSlideContainer: true, responsiveSlides: true, ' . $autoplay_string . ' infiniteSlider: true, navPrevSelector: jQuery("#' . $td_unique_id_slide . ' .prevButton"), navNextSelector: jQuery("#' . $td_unique_id_slide . ' .nextButton") ' . $add_js_resize . ' }); }); '; if ($is_ajax) { $buffy .= '<script>' . $slide_js . '</script>'; } else { td_js_buffer::add_to_footer($slide_js); } return $buffy; }
<?php // Template 7 -post-final-7.psd - full image background $td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full'); if (!empty($td_post_featured_image)) { td_js_buffer::add_to_footer('jQuery(window).ready(function() {' . "\r\n" . '(function(){' . "\r\n" . 'var td_backstr_item = new td_backstr.item();' . "\r\n" . 'td_backstr_item.wrapper_image_jquery_obj = jQuery("#td-full-screen-header-image");' . "\r\n" . 'td_backstr_item.image_jquery_obj = td_backstr_item.wrapper_image_jquery_obj.find(\'img:first\');' . "\r\n" . 'td_backstr.add_item(td_backstr_item);' . "\r\n" . "jQuery('.td-read-down a').click(function(event){" . "\r\n" . "event.preventDefault();" . "\r\n" . "var header_wrap = jQuery('.td-full-screen-header-image-wrap:first')" . "\r\n" . "if (header_wrap.length == 1) {" . "\r\n" . "td_util.scroll_to_position(header_wrap.height() + header_wrap.offset().top, 1200);" . "\r\n" . "}" . "\r\n" . "});" . "\r\n" . '})();' . "\r\n" . '});'); } //get the global sidebar position from single.php global $loop_sidebar_position; // sidebar position used to align the breadcrumb on sidebar left + sidebar first on mobile issue $td_sidebar_position = ''; if ($loop_sidebar_position == 'sidebar_left') { $td_sidebar_position = 'td-sidebar-left'; } $td_mod_single = new td_module_single($post); ?> <article id="post-<?php echo $td_mod_single->post->ID; ?> " class="<?php echo join(' ', get_post_class('td-post-template-7')); ?> " <?php echo $td_mod_single->get_item_scope(); ?> > <div class="td-full-screen-header-image-wrap"> <div class="td-container td-post-header">
/** * @param $posts * @param string $td_column_number - get the column number * @param string $autoplay - not use via ajax * @param bool $is_ajax - if true the script will return the js inline, if not, it will use the td_js_buffer class * @return string */ function inner($posts, $td_column_number = '', $autoplay = '', $is_ajax = false) { //global $post; $buffy = ''; $td_block_layout = new td_block_layout(); if (empty($td_column_number)) { $td_column_number = $td_block_layout->get_column_number(); // get the column width of the block } $td_post_count = 0; // the number of posts rendered $td_current_column = 1; //the current column $td_unique_id_slide = td_global::td_generate_unique_id(); $buffy .= '<div id="' . $td_unique_id_slide . '" class="iosSlider iosSlider-col-' . $td_column_number . ' td_mod_wrap">'; $buffy .= '<div class="slider ">'; if (!empty($posts)) { foreach ($posts as $post) { //$buffy .= td_modules::mod_slide_render($post, $td_column_number, $td_post_count); $td_module_slide = new td_module_slide($post); $buffy .= $td_module_slide->render($td_column_number, $td_post_count); //current column if ($td_current_column == $td_column_number) { $td_current_column = 1; } else { $td_current_column++; } $td_post_count++; } } $buffy .= $td_block_layout->close_all_tags(); $buffy .= '</div>'; //close slider $buffy .= '<div class = "prevButton"></div>'; $buffy .= '<div class = "nextButton"></div>'; $buffy .= '</div>'; //clos ios if (!empty($autoplay)) { $autoplay_string = ' autoSlide: true, autoSlideTimer: ' . $autoplay * 1000 . ', '; } else { $autoplay_string = ''; } $slide_js = ' jQuery(document).ready(function() { jQuery("#' . $td_unique_id_slide . '").iosSlider({ snapToChildren: true, desktopClickDrag: true, keyboardControls: false, ' . $autoplay_string . ' infiniteSlider: true, navPrevSelector: jQuery("#' . $td_unique_id_slide . ' .prevButton"), navNextSelector: jQuery("#' . $td_unique_id_slide . ' .nextButton"), onSlideComplete: slideContentComplete, onSlideStart: slideStartedMoving }); }); '; if ($is_ajax) { $buffy .= '<script>' . $slide_js . '</script>'; } else { td_js_buffer::add_to_footer($slide_js); } return $buffy; }
function inner($posts, $td_column_number = '') { ob_start(); if (!empty($posts[0])) { $post = $posts[0]; //we get only one post $td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full'); $td_mod_single = new td_module_single($post); //make the js template ?> <script type="text/template" id="<?php echo $this->block_uid . '_tmpl'; ?> "> <article id="post-<?php echo $td_mod_single->post->ID; ?> " class="<?php echo join(' ', get_post_class('td-post-template-6')); ?> " <?php echo $td_mod_single->get_item_scope(); ?> > <div class="template6-header"> <div class="td-post-header td-container" id="td_parallax_header_6"> <header class="td-pb-padding-side"> <?php echo $td_mod_single->get_category(); ?> <?php echo $td_mod_single->get_title(); ?> <?php if (!empty($td_mod_single->td_post_theme_settings['td_subtitle'])) { ?> <p class="td-post-sub-title"><?php echo $td_mod_single->td_post_theme_settings['td_subtitle']; ?> </p> <?php } ?> <div class="meta-info"> <?php echo $td_mod_single->get_author(); ?> <?php echo $td_mod_single->get_date(false); ?> <?php echo $td_mod_single->get_views(); ?> <?php echo $td_mod_single->get_comments(); ?> </div> <div class="td-read-down"><a href="#"><i class="td-icon-read-down"></i></a></div> </header> </div> </div> </article> </script> <?php td_js_buffer::add_to_footer("jQuery('body').addClass('single_template_6');" . "\r\n" . "jQuery('body').prepend(jQuery('#" . $this->block_uid . "_tmpl').html());" . "\r\n" . 'jQuery(\'body\').prepend(\'<div class="td-full-screen-header-image-wrap"><div id="td-full-screen-header-image" class="td-image-gradient"></div></div>\');' . "\r\n" . 'jQuery().ready(function() {' . "\r\n" . "jQuery('#td-full-screen-header-image').backstretch('" . $td_post_featured_image . "', {fade:1200, centeredY:false});" . "\r\n" . 'td_post_template_6_title();' . "\r\n" . "jQuery('.td-read-down a').click(function(event){" . "\r\n" . "event.preventDefault();" . "\r\n" . "td_util.scroll_to_position(jQuery('.td-full-screen-header-image-wrap').height(), 1200);" . "\r\n" . "});" . "\r\n" . '});'); } return ob_get_clean(); }
$loop_sidebar_position = td_util::get_option('tds_' . $template_id . '_sidebar_pos'); //sidebar right is default (empty) //override the category global template with the category specific settings if (!empty($tdc_layout)) { $loop_module_id = $tdc_layout; } if (!empty($tdc_sidebar_pos)) { $loop_sidebar_position = $tdc_sidebar_pos; } // sidebar position used to align the breadcrumb on sidebar left + sidebar first on mobile issue $td_sidebar_position = ''; if ($loop_sidebar_position == 'sidebar_left') { $td_sidebar_position = 'td-sidebar-left'; } // make the category pulldown filter list to be equal td_js_buffer::add_to_footer('jQuery().ready(function() {' . "\r\n" . 'var pulldown_size = jQuery(".td-category-pulldown-filter:first").width();' . "\r\n" . 'if (pulldown_size > 113) { jQuery(".td-category-pulldown-filter .td-pulldown-filter-list").css({"min-width": pulldown_size, "border-top": "1px solid #444"}); }' . "\r\n" . '});'); ?> <?php td_api_category_template::_helper_show_category_template(); td_api_category_top_posts_style::_helper_show_category_top_posts_style(); ?> <div class="td-main-content-wrap"> <div class="td-container"> <!-- content --> <div class="td-pb-row"> <?php
?> <?php //if we have a featured image, show it if (!empty($td_post_featured_image)) { ?> <div class="td-big-slide-background"><div id="td-full-screen-header-image" class="td-image-gradient"></div></div> <!-- preload the image --> <img src="<?php echo $td_post_featured_image; ?> " alt="" style="display:none;"/> <?php td_js_buffer::add_to_footer('jQuery().ready(function() {' . "\r\n" . 'jQuery("#td-full-screen-header-image").backstretch("' . $td_post_featured_image . '", {fade:1200, centeredY:false});' . "\r\n" . '});'); } ?> <article id="post-<?php echo $td_mod_single->post->ID; ?> " class="<?php echo join(' ', get_post_class()); ?> " <?php echo $td_mod_single->get_item_scope(); ?> >
<?php // Template 6 - post-final-6.psd - full image background //get the global sidebar position from td_single_template_vars.php locate_template('includes/wp_booster/td_single_template_vars.php', true); get_header(); global $loop_sidebar_position, $td_sidebar_position, $post; $td_mod_single = new td_module_single($post); $td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full'); if (!empty($td_post_featured_image)) { td_js_buffer::add_to_footer('jQuery(window).ready(function() {' . "\r\n" . '(function(){' . "\r\n" . 'var td_backstr_item = new tdBackstr.item();' . "\r\n" . 'td_backstr_item.wrapper_image_jquery_obj = jQuery( "#td-full-screen-header-image" );' . "\r\n" . 'td_backstr_item.image_jquery_obj = td_backstr_item.wrapper_image_jquery_obj.find( \'img:first\' );' . "\r\n" . 'tdBackstr.add_item( td_backstr_item );' . "\r\n" . '})();' . "\r\n" . '});'); } ?> <article id="post-<?php echo $td_mod_single->post->ID; ?> " class="<?php echo join(' ', get_post_class('td-post-template-6')); ?> " <?php echo $td_mod_single->get_item_scope(); ?> > <div class="td-full-screen-header-image-wrap"> <div id="td-full-screen-header-image" class="td-image-gradient-style6"> <img class="td-backstretch" src="<?php echo $td_post_featured_image; ?> ">
function inner($posts, $td_column_number = '') { ob_start(); if (!empty($posts[0])) { $post = $posts[0]; //we get only one post // $td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full'); $td_mod_single = new td_module_single($post); //make the js template ?> <!-- add class to body, no jQuery and inline --> <?php ob_start(); ?> <script> document.body.className+=' td-boxed-layout single_template_8 homepage-post '; </script> <?php echo ob_get_clean(); ?> <script type="text/template" id="<?php echo $this->block_uid . '_tmpl'; ?> "> <article id="post-<?php echo $td_mod_single->post->ID; ?> " class="<?php echo join(' ', get_post_class('post td-post-template-8')); ?> " <?php echo $td_mod_single->get_item_scope(); ?> > <div class="td-post-header td-image-gradient-style8"> <div class="td-crumb-container"><?php echo td_page_generator::get_single_breadcrumbs($td_mod_single->title); ?> </div> <div class="td-post-header-holder"> <header class="td-post-title"> <?php echo $td_mod_single->get_category(); ?> <?php echo $td_mod_single->get_title(); ?> <?php if (!empty($td_mod_single->td_post_theme_settings['td_subtitle'])) { ?> <p class="td-post-sub-title"><?php echo $td_mod_single->td_post_theme_settings['td_subtitle']; ?> </p> <?php } ?> <div class="td-module-meta-info"> <?php echo $td_mod_single->get_author(); ?> <?php echo $td_mod_single->get_date(false); ?> <?php echo $td_mod_single->get_views(); ?> <?php echo $td_mod_single->get_comments(); ?> </div> </header> </div> </div> </article> </script> <?php $td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full'); ob_start(); ?> <script> // add the template jQuery( '.td-header-wrap' ).after( jQuery( '#<?php echo $this->block_uid; ?> _tmpl' ).html() ); // make the wrapper and the image -> and add the image inside var td_homepage_full_bg_image_wrapper = jQuery( '<div class="backstretch"></div>' ); var td_homepage_full_bg_image = jQuery( '<img class="td-backstretch not-parallax" src="<?php echo $td_post_featured_image; ?> "/>' ); td_homepage_full_bg_image_wrapper.append(td_homepage_full_bg_image); // add to body jQuery('body').prepend( td_homepage_full_bg_image_wrapper ); // run the backstracher var td_backstr_item = new tdBackstr.item(); td_backstr_item.wrapper_image_jquery_obj = td_homepage_full_bg_image_wrapper; td_backstr_item.image_jquery_obj = td_homepage_full_bg_image; tdBackstr.add_item( td_backstr_item ); </script> <?php $buffer = ob_get_clean(); $js = "\n" . td_util::remove_script_tag($buffer); td_js_buffer::add_to_footer($js); } return ob_get_clean(); }
function td_bottom_code() { global $post; //buffy before pasting custom css code $buffy_custom_css = ''; $speed_booster = ''; if (defined('TD_SPEED_BOOSTER')) { $speed_booster = 'Speed booster: ' . TD_SPEED_BOOSTER . "\n"; } echo ' <!-- Theme: ' . TD_THEME_NAME . ' by tagDiv 2014 Version: ' . TD_THEME_VERSION . ' (rara) Deploy mode: ' . TD_DEPLOY_MODE . ' ' . $speed_booster . ' uid: ' . uniqid() . ' --> '; //get and paste user custom css $td_custom_css = stripslashes(td_util::get_option('tds_custom_css')); //desktop $td_responsive_css_desktop = stripslashes(td_util::get_option('tds_responsive_css_desktop')); //ipad landscape $td_responsive_css_ipad_landscape = stripslashes(td_util::get_option('tds_responsive_css_ipad_landscape')); //ipad portrait $td_responsive_css_ipad_portrait = stripslashes(td_util::get_option('tds_responsive_css_ipad_portrait')); //phone $td_responsive_css_phone = stripslashes(td_util::get_option('tds_responsive_css_phone')); //check if we have to add the custom css code if (!empty($td_custom_css) || !empty($td_responsive_css_desktop) || !empty($td_responsive_css_ipad_landscape) || !empty($td_responsive_css_ipad_portrait) || !empty($td_responsive_css_phone)) { $buffy_custom_css = ' <style type="text/css" media="screen">'; //paste custom css if (!empty($td_custom_css)) { $buffy_custom_css .= ' ' . $td_custom_css . ' '; } //paste desktop custom css if (!empty($td_responsive_css_desktop)) { $buffy_custom_css .= ' /* responsive monitor */ @media (min-width: 1200px) { ' . $td_responsive_css_desktop . '} '; } //paste ipad landscape custom css if (!empty($td_responsive_css_ipad_landscape)) { $buffy_custom_css .= ' /* responsive landscape tablet */ @media (min-width: 1019px) and (max-width: 1199px) { ' . $td_responsive_css_ipad_landscape . '}'; } //paste ipad portrait custom css if (!empty($td_responsive_css_ipad_portrait)) { $buffy_custom_css .= ' /* responsive portrait tablet */ @media (min-width: 768px) and (max-width: 1018px) { ' . $td_responsive_css_ipad_portrait . '}'; } //paste ipad portrait custom css if (!empty($td_responsive_css_phone)) { $buffy_custom_css .= ' /* responsive phone */ @media (max-width: 767px) { ' . $td_responsive_css_phone . '}'; } $buffy_custom_css .= '</style>'; echo $buffy_custom_css; } //get and paste user custom javascript $td_custom_javascript = stripslashes(td_util::get_option('tds_custom_javascript')); if (!empty($td_custom_javascript)) { echo '<script type="text/javascript">' . $td_custom_javascript . '</script>'; } //AJAX POST VIEW COUNT if (td_util::get_option('tds_ajax_post_view_count') == 'enabled') { //Ajax get & update counter views if (is_single()) { //echo 'post page: '. $post->ID; if ($post->ID > 0) { td_js_buffer::add_to_footer(' jQuery().ready(function jQuery_ready() { td_ajax_count.td_get_views_counts_ajax("post",' . json_encode('[' . $post->ID . ']') . '); }); '); } } } }
<?php echo td_global_blocks::get_instance('td_slide_big')->render(array('sort' => 'featured', 'hide_title' => 'hide_title', 'force_columns' => 3, 'limit' => $td_slide_limit)); ?> </div> </div> <?php } echo td_page_generator::wrap_no_row_with_bg_end(); /* if (!empty($td_slide_background)) { echo '<script>' . "\n"; echo 'jQuery().ready(function() {' . "\n"; echo 'jQuery(".td-big-slide-background").backstretch("' . $td_slide_background . '", {fade:1200});' . "\n"; echo '});' . "\n"; echo '</script>' . "\n"; } */ if (!empty($td_slide_background)) { $buffy = ''; $buffy .= 'jQuery().ready(function() {' . "\n"; $buffy .= 'jQuery(".td-big-slide-background ").backstretch("' . $td_slide_background . '", {fade:1200});' . "\n"; $buffy .= '});' . "\n"; td_js_buffer::add_to_footer($buffy); } if (!empty($td_slide_b_color)) { echo '<style>'; echo '.td-full-layout .td-big-slide-background { background-color:' . $td_slide_b_color . '; }'; echo '.td-boxed-layout .td-big-slide-background .container { background-color:' . $td_slide_b_color . ' !important; }'; echo '</style>'; } }
/** * @param string $output - is empty !!! * @param $atts * @param bool $content * @return mixed */ function td_gallery_shortcode($output = '', $atts, $content = false) { $buffy = ''; //check for gallery = slide if (!empty($atts) and !empty($atts['td_select_gallery_slide']) and $atts['td_select_gallery_slide'] == 'slide') { $td_double_slider2_no_js_limit = 7; $td_nr_columns_slide = 'td-slide-on-2-columns'; $nr_title_chars = 95; //check to see if we have or not sidebar on the page, to set the small images when need to show them on center if (td_global::$cur_single_template_sidebar_pos == 'no_sidebar') { $td_double_slider2_no_js_limit = 11; $td_nr_columns_slide = 'td-slide-on-3-columns'; $nr_title_chars = 170; } $title_slide = ''; //check for the title if (!empty($atts['td_gallery_title_input'])) { $title_slide = $atts['td_gallery_title_input']; //check how many chars the tile have, if more then 84 then that cut it and add ... after if (mb_strlen($title_slide, 'UTF-8') > $nr_title_chars) { $title_slide = mb_substr($title_slide, 0, $nr_title_chars, 'UTF-8') . '...'; } } $slide_images_thumbs_css = ''; $slide_display_html = ''; $slide_cursor_html = ''; $image_ids = explode(',', $atts['ids']); //check to make sure we have images if (count($image_ids) == 1 and !is_numeric($image_ids[0])) { return; } $image_ids = array_map('trim', $image_ids); //trim elements of the $ids_gallery array //generate unique gallery slider id $gallery_slider_unique_id = td_global::td_generate_unique_id(); $cur_item_nr = 1; foreach ($image_ids as $image_id) { //get the info about attachment $image_attachment = td_util::attachment_get_full_info($image_id); //get images url $td_temp_image_url_80x60 = wp_get_attachment_image_src($image_id, 'td_80x60'); //for the slide - for small images slide popup $td_temp_image_url_full = $image_attachment['src']; //default big image - for magnific popup //if we are on full wight (3 columns use the default images not the resize ones) if (td_global::$cur_single_template_sidebar_pos == 'no_sidebar') { $td_temp_image_url = wp_get_attachment_image_src($image_id, 'td_1021x580'); //1021x580 images - for big slide } else { $td_temp_image_url = wp_get_attachment_image_src($image_id, 'td_0x420'); //0x420 image sizes - for big slide } //check if we have all the images if (!empty($td_temp_image_url[0]) and !empty($td_temp_image_url_80x60[0]) and !empty($td_temp_image_url_full)) { //css for display the small cursor image $slide_images_thumbs_css .= ' #' . $gallery_slider_unique_id . ' .td-doubleSlider-2 .td-item' . $cur_item_nr . ' { background: url(' . $td_temp_image_url_80x60[0] . ') 0 0 no-repeat; }'; //html for display the big image $class_post_content = ''; if (!empty($image_attachment['description']) or !empty($image_attachment['caption'])) { $class_post_content = 'td-gallery-slide-content'; } //if picture has caption & description $figcaption = ''; if (!empty($image_attachment['caption']) or !empty($image_attachment['description'])) { $figcaption = '<figcaption class = "td-slide-caption ' . $class_post_content . '">'; if (!empty($image_attachment['caption'])) { $figcaption .= '<div class = "td-gallery-slide-copywrite">' . $image_attachment['caption'] . '</div>'; } if (!empty($image_attachment['description'])) { $figcaption .= '<span>' . $image_attachment['description'] . '</span>'; } $figcaption .= '</figcaption>'; } $slide_display_html .= ' <div class = "td-slide-item td-item' . $cur_item_nr . '"> <figure class="td-slide-galery-figure td-slide-popup-gallery"> <a class="slide-gallery-image-link" href="' . $td_temp_image_url_full . '" title="' . $image_attachment['title'] . '" data-caption="' . esc_attr($image_attachment['caption'], ENT_QUOTES) . '" data-description="' . htmlentities($image_attachment['description'], ENT_QUOTES) . '"> <img src="' . $td_temp_image_url[0] . '" alt="' . htmlentities($image_attachment['alt'], ENT_QUOTES) . '"> </a> ' . $figcaption . ' </figure> </div>'; //html for display the small cursor image $slide_cursor_html .= ' <div class = "td-button td-item' . $cur_item_nr . '"> <div class = "td-border"></div> </div>'; $cur_item_nr++; } //end check for images } //end foreach //check if we have html code for the slider if (!empty($slide_display_html) and !empty($slide_cursor_html)) { //get the number of slides $nr_of_slides = count($image_ids); if ($nr_of_slides < 0) { $nr_of_slides = 0; } $buffy = ' <style type="text/css"> ' . $slide_images_thumbs_css . ' </style> <div id="' . $gallery_slider_unique_id . '" class="' . $td_nr_columns_slide . '"> <div class="post_td_gallery"> <div class="td-gallery-slide-top"> <div class="td-gallery-title">' . $title_slide . '</div> <div class="td-gallery-controls-wrapper"> <div class="td-gallery-slide-count"><span class="td-gallery-slide-item-focus">1</span> ' . __td('of', TD_THEME_NAME) . ' ' . $nr_of_slides . '</div> <div class="td-gallery-slide-prev-next-but"> <i class = "td-icon-left doubleSliderPrevButton"></i> <i class = "td-icon-right doubleSliderNextButton"></i> </div> </div> </div> <div class = "td-doubleSlider-1 "> <div class = "td-slider"> ' . $slide_display_html . ' </div> </div> <div class = "td-doubleSlider-2"> <div class = "td-slider"> ' . $slide_cursor_html . ' </div> </div> </div> </div> '; $slide_javascript = ' //total number of slides var ' . $gallery_slider_unique_id . '_nr_of_slides = ' . $nr_of_slides . '; jQuery(document).ready(function() { //magnific popup jQuery("#' . $gallery_slider_unique_id . ' .td-slide-popup-gallery").magnificPopup({ delegate: "a", type: "image", tLoading: "Loading image #%curr%...", mainClass: "mfp-img-mobile", gallery: { enabled: true, navigateByImgClick: true, preload: [0,1], tCounter: \'%curr% ' . __td('of', TD_THEME_NAME) . ' %total%\' }, image: { tError: "<a href=\'%url%\'>The image #%curr%</a> could not be loaded.", titleSrc: function(item) {//console.log(item.el); //alert(jQuery(item.el).data("caption")); return item.el.attr("data-caption") + "<div>" + item.el.attr("data-description") + "<div>"; } }, zoom: { enabled: true, duration: 300, opener: function(element) { return element.find("img"); } }, callbacks: { change: function() { // Will fire when popup is closed jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-1").iosSlider("goToSlide", this.currItem.index + 1 ); } } }); jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-1").iosSlider({ scrollbar: true, snapToChildren: true, desktopClickDrag: true, infiniteSlider: true, responsiveSlides: true, navPrevSelector: jQuery("#' . $gallery_slider_unique_id . ' .doubleSliderPrevButton"), navNextSelector: jQuery("#' . $gallery_slider_unique_id . ' .doubleSliderNextButton"), scrollbarHeight: "2", scrollbarBorderRadius: "0", scrollbarOpacity: "0.5", onSliderResize: td_gallery_resize_update_vars_' . $gallery_slider_unique_id . ', onSliderLoaded: doubleSlider2Load_' . $gallery_slider_unique_id . ', onSlideChange: doubleSlider2Load_' . $gallery_slider_unique_id . ', keyboardControls:true }); //small image slide jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2 .td-button").each(function(i) { jQuery(this).bind("click", function() { jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-1").iosSlider("goToSlide", i+1); }); }); //check the number of slides if(' . $gallery_slider_unique_id . '_nr_of_slides > ' . $td_double_slider2_no_js_limit . ') { jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2").iosSlider({ desktopClickDrag: true, snapToChildren: true, snapSlideCenter: true, infiniteSlider: true }); } else { jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2").addClass("td_center_slide2"); } function doubleSlider2Load_' . $gallery_slider_unique_id . '(args) { //var currentSlide = args.currentSlideNumber; jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2").iosSlider("goToSlide", args.currentSlideNumber); //put a transparent border around all small sliders jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2 .td-button .td-border").css("border", "3px solid #ffffff").css("opacity", "0.5"); jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2 .td-button").css("border", "0"); //put a white border around the focused small slide jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2 .td-button:eq(" + (args.currentSlideNumber-1) + ") .td-border").css("border", "3px solid #ffffff").css("opacity", "1"); //jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-2 .td-button:eq(" + (args.currentSlideNumber-1) + ")").css("border", "3px solid #ffffff"); //write the current slide number td_gallery_write_current_slide_' . $gallery_slider_unique_id . '(args.currentSlideNumber); } //writes the current slider beside to prev and next buttons function td_gallery_write_current_slide_' . $gallery_slider_unique_id . '(slide_nr) { jQuery("#' . $gallery_slider_unique_id . ' .td-gallery-slide-item-focus").html(slide_nr); } /* * Resize the iosSlider when the page is resided (fixes bug on Android devices) */ function td_gallery_resize_update_vars_' . $gallery_slider_unique_id . '(args) { if(tdDetect.isAndroid) { setTimeout(function(){ jQuery("#' . $gallery_slider_unique_id . ' .td-doubleSlider-1").iosSlider("update"); }, 1500); } } });'; td_js_buffer::add_to_footer($slide_javascript); } //end check if we have html code for the slider } //end if slide //!!!!!! WARNING //$return has to be != empty to overwride the default output return $buffy; }
protected function render_after_list_wrap() { $buffy = ''; $buffy .= '</div>'; $buffy .= '</div>'; // end ios slider $buffy .= '<div class="td-sml3-bottom-controls">' . $this->slide_controls . '</div>'; //bottom controls $buffy .= '</div>'; //.td_smart_list_3 wrapper with id // @todo fix the moving from left to right from the controls, now the slide only works from right to left, td_js_buffer::add_to_footer(' jQuery(document).ready(function() { jQuery("#' . $this->smart_list_tip_3_unique_id . '").iosSlider({ snapToChildren: true, desktopClickDrag: true, keyboardControls: false, infiniteSlider: true, navPrevSelector: jQuery(".td_smart_list_3 .doubleSliderPrevButton"), navNextSelector: jQuery(".td_smart_list_3 .doubleSliderNextButton"), startAtSlide:td_history.get_current_page("slide"), onSliderLoaded : td_resize_smartlist_slides, onSliderResize : td_resize_smartlist_sliders_and_update, onSlideChange : td_resize_smartlist_slides, onSlideComplete : td_history.slide_changed_callback }); // add current page history td_history.replace_history_entry({current_slide:td_history.get_current_page("slide"), slide_id:"' . $this->smart_list_tip_3_unique_id . '"}); }); '); return $buffy; }
<?php // Template 6 - post-final-6.psd - full image background $td_post_featured_image = td_util::get_featured_image_src($post->ID, 'full'); //if we have a featured image, show it if (!empty($td_post_featured_image)) { //css fix add gradient overlay + shadow td_js_buffer::add_to_footer('jQuery().ready(function() {' . "\r\n" . 'jQuery(\'body\').prepend(\'<div class="td-full-screen-header-image-wrap"><div id="td-full-screen-header-image" class="td-image-gradient"></div></div>\');' . "\r\n" . "jQuery('#td-full-screen-header-image').backstretch('" . $td_post_featured_image . "', {fade:1200, centeredY:false});" . "\r\n" . 'td_post_template_6_title();' . "\r\n" . '});'); } //get the global sidebar position from single.php global $loop_sidebar_position; $td_mod_single = new td_module_single($post); ?> <article id="post-<?php echo $td_mod_single->post->ID; ?> " class="<?php echo join(' ', get_post_class('td-post-template-6')); ?> " <?php echo $td_mod_single->get_item_scope(); ?> > <div class="template6-header"> <div class="td-post-header td-container" id="td_parallax_header_6"> <header class="td-pb-padding-side"> <?php echo $td_mod_single->get_category();