protected function content($atts, $content = null) { $atts = shortcode_atts(array('element_id' => '', 'source' => '', 'cell_height' => 120, 'space' => 20, 'template' => '', 'class' => ''), $atts); /** * Enqueue script */ LemonGrid::include_script(); $templateParams = json_decode($atts['template'], true); $atts['class_id'] = 'lemon_grid_id_' . $atts['element_id']; $atts['template'] = $templateParams['template']; $atts['template_params'] = $templateParams; /** * wp_query */ list($args, $wp_query) = vc_build_loop_query($atts['source']); $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1; if ($paged > 1) { $args['paged'] = $paged; $wp_query = new WP_Query($args); } $atts['posts'] = $wp_query; wp_enqueue_style('tb-lemongrid-custom-script', TB_CSS . 'lemongrid-custom-script.css'); wp_add_inline_style('tb-lemongrid-custom-script', renderGridCustomSpaceCss($atts['class_id'], $atts['space'])); return lgLoadTemplate($atts, $content); }
protected function getLoop($loop) { global $vc_posts_grid_exclude_id; $vc_posts_grid_exclude_id[] = get_the_ID(); require_once vc_path_dir('PARAMS_DIR', 'loop/loop.php'); list($this->loop_args, $this->query) = vc_build_loop_query($loop, $vc_posts_grid_exclude_id); }
protected function content($atts, $content = null) { //default value $atts_extra = shortcode_atts(array('xsmall_items' => 1, 'small_items' => 2, 'medium_items' => 3, 'large_items' => 4, 'margin' => 0, 'loop' => 1, 'mousedrag' => 1, 'touchdrag' => 1, 'nav' => 1, 'dots' => 1, 'center' => 0, 'autoplay' => 1, 'autoplaytimeout' => '5000', 'smartspeed' => '250', 'autoplayhoverpause' => 1, 'left_arrow' => 'fa fa-arrow-left', 'right_arrow' => 'fa fa-arrow-right', 'filter' => "false", 'class' => ''), $atts); global $zo_carousel; $atts = array_merge($atts_extra, $atts); wp_enqueue_style('owl-carousel', ZO_CSS . 'owl.carousel.css', '', '2.0.0b', 'all'); wp_enqueue_script('owl-carousel', ZO_JS . 'owl.carousel.js', array('jquery'), '2.0.0b', true); wp_enqueue_script('owl-autoplay', ZO_JS . 'owl.autoplay.js', array('jquery'), '2.0.0b', true); wp_enqueue_script('owl-navigation', ZO_JS . 'owl.navigation.js', array('jquery'), '2.0.0b', true); wp_enqueue_script('owl-animate', ZO_JS . 'owl.animate.js', array('jquery'), '2.0.0b', true); wp_enqueue_script('owl-carousel-zo', ZO_JS . 'owl.carousel.zo.js', array('jquery'), '1.0.0', true); $source = $atts['source']; list($args, $posts) = vc_build_loop_query($source); $atts['posts'] = $posts; $html_id = zoHtmlID('zo-carousel'); $atts['autoplaytimeout'] = isset($atts['autoplaytimeout']) ? (int) $atts['autoplaytimeout'] : 5000; $atts['smartspeed'] = isset($atts['smartspeed']) ? (int) $atts['smartspeed'] : 250; $left_arrow = isset($atts['left_arrow']) ? $atts['left_arrow'] : 'fa fa-arrow-left'; $right_arrow = isset($atts['right_arrow']) ? $atts['right_arrow'] : 'fa fa-arrow-right'; $zo_carousel[$html_id] = array('margin' => (int) $atts['margin'], 'loop' => $atts['loop'] == 1 ? true : false, 'mouseDrag' => $atts['mousedrag'] == 1 ? true : false, 'touchDrag' => $atts['touchdrag'] == 1 ? true : false, 'nav' => $atts['nav'] == 1 ? true : false, 'dots' => $atts['dots'] == 1 ? true : false, 'center' => $atts['center'] == 1 ? true : false, 'autoplay' => $atts['autoplay'] == 1 ? true : false, 'autoplayTimeout' => $atts['autoplaytimeout'], 'smartSpeed' => $atts['smartspeed'], 'autoplayHoverPause' => $atts['autoplayhoverpause'] == 1 ? true : false, 'navText' => array('<i class="' . $left_arrow . '"></i>', '<i class="' . $right_arrow . '"></i>'), 'dotscontainer' => $html_id . ' .zo-dots', 'items' => (int) $atts['large_items'], 'responsive' => array(0 => array("items" => (int) $atts['xsmall_items']), 768 => array("items" => (int) $atts['small_items']), 992 => array("items" => (int) $atts['medium_items']), 1200 => array("items" => (int) $atts['large_items']))); wp_localize_script('owl-carousel-zo', "zocarousel", $zo_carousel); $atts['template'] = 'template-' . str_replace('.php', '', $atts['zo_template']) . ' ' . $atts['class']; $atts['html_id'] = $html_id; return parent::content($atts, $content); }
protected function content($atts, $content = null) { $html_id = tbHtmlID('tb-masonry'); $source = $atts['source']; list($args, $wp_query) = vc_build_loop_query($source); $atts['cat'] = isset($args['cat']) ? $args['cat'] : ''; /* get posts */ $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1; if ($paged > 1) { $args['paged'] = $paged; $wp_query = new WP_Query($args); } $atts['posts'] = $wp_query; $grid = shortcode_atts(array('col_lg' => 4, 'col_md' => 3, 'col_sm' => 2, 'col_xs' => 1, 'layout' => 'basic', 'margin' => 0, 'ratio' => 0.5), $atts); $atts['item_class'] = "tb-masonry-item"; $class = isset($atts['class']) ? $atts['class'] : ''; $atts['template'] = 'template-' . str_replace('.php', '', $atts['tb_template']) . ' ' . $class; $atts['post_id'] = get_the_ID(); $atts['html_id'] = $html_id; //Masonry Settings global $tb_masonry; $tb_masonry[$html_id] = array('post_id' => get_the_ID(), 'grid_margin' => (int) $atts['margin'], 'grid_ratio' => (double) $atts['ratio'], 'grid_cols_xs' => (int) $grid['col_xs'], 'grid_cols_sm' => (int) $grid['col_sm'], 'grid_cols_md' => (int) $grid['col_md'], 'grid_cols_lg' => (int) $grid['col_lg']); wp_localize_script('tb-masonry', "tbMasonry", $tb_masonry); wp_enqueue_script('tb-masonry'); if (current_user_can('manage_options')) { wp_enqueue_script('jquery-ui-resizable'); wp_enqueue_style('tb-jquery-ui'); wp_enqueue_script('tb-masonry-admin'); } return parent::content($atts, $content); }
protected function content($atts, $content = null) { wp_enqueue_script('tb-grid-pagination', TB_JS . 'tbgrid.pagination.js', array('jquery'), '1.0.0', true); $html_id = tbHtmlID('tb-grid'); $source = $atts['source']; list($args, $wp_query) = vc_build_loop_query($source); $paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1; if ($paged > 1) { $args['paged'] = $paged; $wp_query = new WP_Query($args); } $atts['cat'] = isset($args['cat']) ? $args['cat'] : ''; /* get posts */ $atts['posts'] = $wp_query; $grid = shortcode_atts(array('col_lg' => 4, 'col_md' => 3, 'col_sm' => 2, 'col_xs' => 1, 'layout' => 'basic'), $atts); $col_lg = 12 / $grid['col_lg']; $col_md = 12 / $grid['col_md']; $col_sm = 12 / $grid['col_sm']; $col_xs = 12 / $grid['col_xs']; $atts['item_class'] = "tb-grid-item col-lg-{$col_lg} col-md-{$col_md} col-sm-{$col_sm} col-xs-{$col_xs}"; $atts['grid_class'] = "tb-grid"; $class = isset($atts['class']) ? $atts['class'] : ''; $atts['template'] = 'template-' . str_replace('.php', '', $atts['tb_template']) . ' ' . $class; if ($grid['layout'] == 'masonry') { wp_enqueue_script('tb-jquery-shuffle'); $atts['grid_class'] .= " tb-grid-{$grid['layout']}"; } $atts['html_id'] = $html_id; return parent::content($atts, $content); }
protected function getLoop($loop) { list($this->loop_args, $this->query) = vc_build_loop_query($loop, get_the_ID()); }
<?php $title = $grid_columns_count = $grid_layout = $grid_link = $grid_link_target = ''; $grid_template = $grid_thumb_size = $grid_layout_mode = ''; $grid_content = $el_class = $width = $orderby = $order = $el_position = $isotope_item = $teasers = $taxonomies = ''; $output = $loop = ''; $template_path = ''; $teaser_categories = array(); extract(shortcode_atts(array('title' => '', 'grid_columns_count' => 4, 'grid_teasers_count' => 8, 'grid_layout' => 'title_thumbnail_text', 'grid_link' => 'link_post', 'grid_link_target' => '_self', 'grid_template' => 'grid', 'grid_thumb_size' => 'thumbnail', 'grid_layout_mode' => 'fitRows', 'grid_content' => 'teaser', 'el_class' => '', 'width' => '1/1', 'orderby' => NULL, 'order' => 'DESC', 'loop' => ''), $atts)); list($args, $my_query) = vc_build_loop_query($loop); // /** * Enqueue isotope js/css if required * {{ */ if ($grid_template == 'grid' || $grid_template == 'filtered_grid') { wp_enqueue_style('isotope-css'); wp_enqueue_script('isotope'); $isotope_item = 'isotope-item '; } else { if ($grid_template == 'carousel') { wp_enqueue_script('jcarousellite'); $isotope_item = ''; } } // }} /** * Enqueue prettyphoto js/css if required. * {{ */ if ($grid_link == 'link_image' || $grid_link == 'link_image_post') {
public function content($atts, $content = null) { if (!is_shop_supported()) { return ''; } extract(shortcode_atts(array('products_query' => '', 'product_types_to_show' => '', 'columns' => '', 'auto_rotate' => '', 'el_class' => '', 'css' => ''), $atts)); $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'lab-vc-products-carousel woocommerce shop wpb_content_element products-hidden ' . $el_class . vc_shortcode_custom_css_class($css, ' '), $this->settings['base'], $atts); if ($columns == 1) { $css_class .= ' single-column'; } list($args, $products) = vc_build_loop_query($products_query); # Show Featured Products Only if ($product_types_to_show == 'only_featured') { $args['meta_key'] = '_featured'; $args['meta_value'] = 'yes'; $products = new WP_Query($args); } else { # Show Products on Sale Only if ($product_types_to_show == 'only_on_sale') { $args['meta_query'] = array('relation' => 'OR', array('key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric'), array('key' => '_min_variation_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric')); $products = new WP_Query($args); } } $rand_id = "el_" . time() . mt_rand(10000, 99999); $columns = absint($columns); wp_enqueue_script('slick'); wp_enqueue_style('slick'); ob_start(); add_filter('get_data_shop_loop_masonry', '__return_false', 100); ?> <div class="<?php echo $css_class; ?> " id="<?php echo $rand_id; ?> "> <div class="shop-loading-products"> <?php _e('Loading products...', 'kalium'); ?> </div> <?php add_filter('lab_wc_product_grid_columns', '__return_false'); if ($products->have_posts()) { ?> <?php woocommerce_product_loop_start(); ?> <?php while ($products->have_posts()) { $products->the_post(); ?> <?php wc_get_template_part('content', 'product'); ?> <?php } // end of the loop. ?> <?php woocommerce_product_loop_end(); ?> <?php } remove_filter('lab_wc_product_grid_columns', '__return_false'); wp_reset_postdata(); ?> </div> <script type="text/javascript"> jQuery( document ).ready( function( $ ) { var $productsCarouselContainer = $( '#<?php echo $rand_id; ?> ' ), $productsCarousel = $productsCarouselContainer.find( '.products' ); $productsCarouselContainer.removeClass( 'products-hidden' ); $productsCarousel.slick( { infinite: false, slidesToShow: <?php echo $columns; ?> , slidesToScroll: 1, prevArrow: '<span class="nextprev-arrow ss-prev"><i class="flaticon-arrow427"></i></span>', nextArrow: '<span class="nextprev-arrow ss-next"><i class="flaticon-arrow413"></i></span>', adaptiveHeight: true, <?php if ($auto_rotate > 0) { ?> autoplay: true, autoplaySpeed: <?php echo $auto_rotate * 1000; ?> , <?php } ?> responsive: [ { breakpoint: 1119, settings: { slidesToShow: <?php echo min($columns, 3); ?> } }, { breakpoint: 768, settings: { slidesToShow: 2 } }, { breakpoint: 600, settings: { slidesToShow: 1 } } ] } ); } ); </script> <?php remove_filter('get_data_shop_loop_masonry', '__return_false', 100); $output = ob_get_contents(); ob_end_clean(); return $output; }
protected function getLoop( $loop ) { require_once vc_path_dir( 'PARAMS_DIR', 'loop/loop.php' ); list( $this->loop_args, $this->query ) = vc_build_loop_query( $loop, get_the_ID() ); }
function widget() { global $xt_global_where, $wpdb; $query_args = array('post_type' => 'post', 'posts_per_page' => $this->instance['number'], 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true); if (!empty($this->instance['query_type'])) { $query_type = $this->instance['query_type']; if ($query_type == 'most-viewed') { $query_args['meta_key'] = 'xt_post_views_count'; $query_args['orderby'] = 'meta_value_num'; $query_args['order'] = 'DESC'; } else { if ($query_type == 'most-liked') { $query_args['meta_key'] = '_votes_likes'; $query_args['orderby'] = 'meta_value_num'; $query_args['order'] = 'DESC'; } else { if ($query_type == 'most-discussed') { $query_args['orderby'] = 'comment_count'; $query_args['order'] = 'DESC'; if (!empty($this->instance['must_have_comments'])) { $xt_global_where = "AND {$wpdb->posts}.comment_count > 0"; } } else { if ($query_type == 'selection' && !empty($this->instance['include_posts'])) { $selection = $this->instance['include_posts']; if (!is_array($selection)) { $selection = explode(",", $selection); } $query_args["post__in"] = $selection; $query_args['orderby'] = 'post__in'; $this->instance['category'] = false; $this->instance['number'] = false; $this->instance['query_post_formats'] = false; $this->instance['format'] = false; $query_args["posts_per_page"] = -1; } else { if ($query_type == 'custom') { list($query_args, $query) = vc_build_loop_query($this->instance['custom_query'], get_the_ID()); } } } } } } if ($query_type != 'custom') { if (!empty($this->instance['query_post_formats'])) { if (!empty($this->instance['format'])) { $format = $this->instance['format']; if (!is_array($format)) { $format = explode(",", $format); } $query_args['tax_query'] = array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => $format, 'operator' => 'IN')); } } else { if ($query_type != 'selection') { $exclude_formats = xt_get_post_formats(true); $query_args['tax_query'] = array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => $exclude_formats, 'operator' => 'NOT IN')); } } if (!empty($this->instance['category']) || !empty($this->instance['exclude_category'])) { $categories = array(); if (!empty($this->instance['category'])) { $category = $this->instance['category']; if (!is_array($category)) { $category = explode(",", $category); } $categories = array_merge($categories, $category); } if (!empty($this->instance['exclude_category'])) { $category = $this->instance['exclude_category']; if (!is_array($category)) { $category = explode(",", $category); } foreach ($category as $key => $cat) { $category[$key] = -$cat; } $categories = array_merge($categories, $category); } if (!empty($categories)) { if (is_array($categories)) { $categories = implode(",", $categories); } $query_args["cat"] = $categories; } } } if ($query_type != 'custom') { $query = new WP_Query(apply_filters('xt_widget_news_args', $query_args)); } if ($query->have_posts()) { $this->query = $query; $action_title = $this->instance['action_title']; $action_obj_id = $this->instance['action_obj_id']; $action_ext_link = $this->instance['action_ext_link']; /***/ $action = $this->actionLink($action_obj_id, $action_ext_link, $action_title); if (!empty($this->instance['title'])) { echo '<span class="heading-t3"></span>'; echo '<h3 class="widgettitle">' . $this->instance['title'] . ' ' . $action . '</h3>'; echo '<span class="heading-b3"></span>'; } $this->render(); // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); } }
protected function content($atts, $content = null) { extract(shortcode_atts(array('loop' => '', 'columns_num' => '1', 'style' => '1'), $atts)); // $css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, vc_shortcode_custom_css_class( $css, ' ' ), $this->settings['base'], $atts ); switch ($columns_num) { case '1': $col_class = 'col_1'; break; case '2': $col_class = 'col_2'; break; case '3': $col_class = 'col_3'; break; case '4': $col_class = 'col_4'; break; default: $col_class = 'col_2'; break; } list($args, $loop) = vc_build_loop_query($loop); $my_query = new WP_Query($args); ob_start(); ?> <div class="posts_wrap_section"> <?php if ($my_query->have_posts()) { while ($my_query->have_posts()) { $my_query->the_post(); ?> <?php if ($style == '1' || $style == '2' || $style == '5') { ?> <div class="post_holder match-me <?php echo esc_attr($col_class); ?> "> <?php if ($style == '1') { ?> <?php if (has_post_thumbnail()) { echo '<a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_ID(), 'global') . '</a>'; } ?> <?php } else { ?> <?php if (has_post_thumbnail()) { ?> <a href="<?php the_permalink(); ?> "> <?php if ($style == '2') { ?> <div class="style_two_hover"> <div class="post_metas"><?php $term_list = wp_get_post_terms(get_the_ID(), 'category', array("fields" => "names")); foreach ($term_list as $name) { echo esc_html($name) . " "; } ?> </div> <h1><?php the_title(); ?> </h1> </div> <?php } ?> <?php the_post_thumbnail('global'); ?> </a> <?php } ?> <?php } ?> <div class="post_holder_content <?php echo $style == 2 ? 'style_two' : ''; ?> <?php echo $style == 5 ? 'absolute_wrap_content' : ''; ?> "> <?php if ($style != '2') { ?> <div class="post_metas"><?php echo get_the_term_list(get_the_ID(), 'category', '', ', ', ''); ?> </div> <h1><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h1> <?php } ?> <?php the_excerpt(); ?> <a class="rounded-normal" href="<?php the_permalink(); ?> "><?php _e('Read More', THEME_NAME); ?> </a> </div> </div> <?php } elseif ($style == '3') { ?> <div class="post_wrap_holder match-me <?php echo esc_attr($col_class); ?> "> <div> <?php if (has_post_thumbnail()) { ?> <div> <a href="<?php the_permalink(); ?> "><span><i class="icon icon-add-1"></i></span><?php the_post_thumbnail('global'); ?> </a> </div> <?php } ?> <div> <h1><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h1> <?php the_excerpt(); ?> </div> </div> </div> <?php } else { ?> <div class="latest_new_wraper match-me <?php echo esc_attr($col_class); ?> "> <?php if (has_post_thumbnail()) { ?> <div><a href="<?php the_permalink(); ?> "><?php the_post_thumbnail(); ?> </a></div> <?php } ?> <div> <div class="post_metas"><?php echo get_the_term_list(get_the_ID(), 'category', '', ', ', ''); ?> </div> <h1><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h1> <?php the_excerpt(); ?> <a href="<?php the_permalink(); ?> " class="rounded-normal"><?php _e('Read More', THEME_NAME); ?> </a> </div> </div> <?php } ?> <?php } } ?> </div> <?php $output = ob_get_contents(); ob_end_clean(); return $output; }
* @since 1.0.0 * * @author 8guild * @package Appica * @subpackage Core */ if (!function_exists('vc_path_dir') || !function_exists('vc_build_loop_query')) { return; } $a = shortcode_atts(array('loop' => '', 'extra_class' => ''), $atts); $extra = Appica_Helpers::get_class_set($a['extra_class']); if ('' === $a['loop']) { return; } require_once vc_path_dir('PARAMS_DIR', 'loop/loop.php'); list($loop_args, $query) = vc_build_loop_query($a['loop']); if ($query->have_posts()) { ?> <div class="masonry-grid"> <div class="grid-sizer"></div> <div class="gutter-sizer"></div> <?php while ($query->have_posts()) { $query->the_post(); ?> <div id="post-<?php the_ID(); ?>
<?php $output = $template = $title = $loop = $posts_clauses = $only_content = $carousel = $item_margin = $posts_per_item = $el_class = $css = ''; extract(shortcode_atts(array('title' => '', 'loop' => '', 'posts_clauses' => '', 'template' => 'post', 'only_content' => false, 'carousel' => false, 'item_margin' => 0, 'posts_per_item' => 1, 'el_class' => '', 'css' => ''), $atts)); $el_class = $this->getExtraClass($el_class); $css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $el_class . vc_shortcode_custom_css_class($css, ' '), $this->settings['base'], $atts); global $vc_posts_grid_exclude_id; $vc_posts_grid_exclude_id[] = get_the_ID(); require_once vc_path_dir('PARAMS_DIR', 'loop/loop.php'); list($loop_args, $query) = vc_build_loop_query($loop, $vc_posts_grid_exclude_id); $loop_args['ignore_sticky_posts'] = true; if (!empty($posts_clauses) && function_exists('posts_clauses')) { add_filter('posts_clauses', $posts_clauses); } $query = new WP_Query($loop_args); if (!empty($posts_clauses) && function_exists('posts_clauses')) { remove_filter('posts_clauses', $posts_clauses); } if ($carousel) { wp_enqueue_script('owl.carousel'); wp_enqueue_style('owl.carousel'); } if ($query->have_posts()) { $options = get_option(AZEXO_THEME_NAME); if ($only_content) { $size = array('width' => '', 'height' => ''); } else { $thumbnail_size = isset($options[$template . '_thumbnail_size']) && !empty($options[$template . '_thumbnail_size']) ? $options[$template . '_thumbnail_size'] : 'large'; azexo_add_image_size($thumbnail_size); $size = get_image_sizes($thumbnail_size); }
<?php global $vc_teaser_box; $posts_query = $el_class = $args = $my_query = $speed = $mode = $swiper_options = ''; $content = $link = $layout = $thumb_size = $link_target = $slides_per_view = $wrap = ''; $autoplay = $hide_pagination_control = $hide_prev_next_buttons = $title = ''; $posts = array(); $atts = vc_map_get_attributes($this->getShortcode(), $atts); extract($atts); list($args, $my_query) = vc_build_loop_query($posts_query); // $teaser_blocks = vc_sorted_list_parse_value($layout); while ($my_query->have_posts()) { $my_query->the_post(); // Get post from query $post = new stdClass(); // Creating post object. $post->id = get_the_ID(); $post->link = get_permalink($post->id); $post->post_type = get_post_type(); if ($vc_teaser_box->getTeaserData('enable', $post->id) === '1') { $post->custom_user_teaser = true; $data = $vc_teaser_box->getTeaserData('data', $post->id); if (!empty($data)) { $data = json_decode($data); } $post->bgcolor = $vc_teaser_box->getTeaserData('bgcolor', $post->id); $post->custom_teaser_blocks = array(); $post->title_attribute = the_title_attribute('echo=0'); if (!empty($data)) { foreach ($data as $block) {
protected function content($atts, $content = null) { global $ivan_custom_css; // Extract shortcode attributes extract(shortcode_atts(array('loop' => '', 'ivan_columns' => '4', 'ivan_type' => 'mansory', 'ivan_margin' => '', 'ivan_opacity' => '', 'ivan_zoom' => '', 'ivan_grayscale' => '', 'ivan_cover' => '', 'ivan_cover_hover' => '', 'ivan_img_size' => 'large', 'ivan_custom_height' => '', 'ivan_enable_thumb' => 'yes', 'ivan_enable_cover' => 'yes', 'ivan_enable_title' => 'yes', 'ivan_enable_categories' => 'yes', 'ivan_enable_excerpt' => '', 'ivan_enable_read_more' => '', 'ivan_enable_read_more_txt' => 'READ MORE', 'ivan_carousel_nav' => 'yes', 'ivan_carousel_bullets' => 'yes', 'ivan_enable_sizes' => 'no', 'el_class' => ''), $atts)); if (empty($loop)) { return; } $output = ''; $loop_args = array(); $query = false; list($loop_args, $query) = vc_build_loop_query($loop, get_the_ID()); //$output .= '<div>'.var_export($loop_args, true).'</div>'; if (!$query) { return; } // Output customizer rules foreach ($this->selectors as $key => $value) { if (isset($atts[$key]) && '' != $atts[$key]) { preg_match("!\\{\\s*([^\\}]+)\\s*\\}!", $atts[$key], $match); if (!empty($match[0])) { $this->prefix = str_replace(array('{', '}'), '', $match[0]) . ' '; $atts[$key] = str_replace($match[0], "", $atts[$key]); } } } $ivan_query = $query; $colNumber = $ivan_columns; $columns = 12 / $colNumber; // 12 Bootstrap Columns / number of columns // Container $type = $ivan_type; $containerClass = 'ivan-projects ivan-posts ivan-projects-' . $type; $containerClass .= ' row'; $containerClass .= $ivan_margin; // If prefix is not defined if ('' == $this->prefix) { $this->prefix = 'vc_custom_' . rand(25, 15000); } $output .= '<div class="ivan-projects-main-wrapper ivan-posts-main-wrapper ' . str_replace('.', '', $this->prefix) . '">'; $additionalClass = ''; $additionalClass .= $ivan_opacity; $additionalClass .= $ivan_zoom; $additionalClass .= $ivan_cover; $additionalClass .= $ivan_cover_hover; if ('yes' == $ivan_grayscale) { $additionalClass .= ' gray-enabled'; } if ($ivan_query->have_posts()) { if ('carousel' == $type) { wp_enqueue_script('ivan_owl_carousel'); wp_enqueue_style('ivan_owl_carousel'); $columns = 12; } wp_enqueue_style('ivan_vc_projects'); wp_enqueue_script('ivan_vc_projects'); $output .= '<div class="' . $containerClass . '">'; $output .= '<div class="gutter-sizer"></div>'; // Carousel Markup if ('carousel' == $type) { $output .= '<div class="owl-carousel">'; } ob_start(); while ($ivan_query->have_posts()) { $ivan_query->the_post(); $singleColumn = $columns; $singleTags = ''; // If mansory, apply custom tags to change size if ('mansory' == $type && 'yes' == $ivan_enable_sizes) { $_tags = get_the_tags(get_the_ID()); if ($_tags) { foreach ($_tags as $_tag) { if ($_tag->name == 'double') { if ($singleColumn == 4) { // 3 Cols $singleColumn = 8; } else { if ($singleColumn == 3) { // 4 Cols $singleColumn = 6; } else { if ($singleColumn == 6) { // 2 Cols $singleColumn = 12; } } } $singleTags .= ' double-size'; } else { if ($_tag->name == 'full') { $singleColumn = 12; $singleTags .= 'full-size'; } else { if ($_tag->name == 'half-height') { $singleTags .= ' half-height'; } } } } } } ?> <div class="col-xs-12 col-sm-<?php echo $singleColumn; ?> col-md-<?php echo $singleColumn; ?> taphover ivan-project <?php echo $singleTags; ?> <?php echo $additionalClass; ?> "> <div class="ivan-project-inner"> <?php // Custom Thumbnail Height $_customHeight = ''; $_thumbClass = ''; if ($ivan_custom_height != '') { $_customHeight = 'height:' . str_replace('px', '', $ivan_custom_height) . 'px;'; } if (has_post_thumbnail() == false) { $_thumbClass = ' no-thumb'; } ?> <?php if ('yes' == $ivan_enable_thumb) { ?> <a href="<?php the_permalink(); ?> " class="thumbnail<?php echo $_thumbClass; ?> " style="<?php echo $_customHeight; ?> "> <span class="ivan-hover-fx"></span> <?php echo get_the_post_thumbnail(get_the_ID(), $ivan_img_size); ?> </a> <?php } ?> <?php if ('yes' == $ivan_enable_cover) { ?> <div class="entry"> <div class="entry-inner"> <div class="centered"> <?php if ('yes' == $ivan_enable_title) { ?> <h3><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h3> <?php } ?> <?php if ('yes' == $ivan_enable_categories) { ?> <div class="categories"> <span class="date"><?php echo get_the_date(); ?> </span> </div> <?php } ?> <?php if ('yes' == $ivan_enable_excerpt) { ?> <div class="excerpt"><?php the_excerpt(); ?> </div> <?php } ?> <?php if ('yes' == $ivan_enable_read_more) { ?> <div class="read-more"> <a href="<?php the_permalink(); ?> " class="button"><?php echo $ivan_enable_read_more_txt; ?> </a> </div> <?php } ?> </div> </div> </div> <?php } ?> </div> <div></div> </div> <?php } $output .= ob_get_clean(); if ('carousel' == $type) { $output .= '</div>'; } $output .= '</div>'; // #row $output .= '</div>'; // #main-wrapper $output .= '<script type="text/javascript"> jQuery(document).ready( function() { '; if (is_admin()) { $output .= ' ivan_vc_hide_entry(); ivan_vc_init_mansory(); if(typeof jQuery.fn.owlCarousel == "function") {'; } if ('carousel' == $type) { $_prefix = str_replace('.', '', $this->prefix); $carouselCode = ' _carousel.owlCarousel({ items: ' . $colNumber . ', itemsDesktop:[1199,' . $colNumber . '], autoHeight: true'; if ($ivan_columns == '1') { $carouselCode .= ',singleItem: true'; } if ('yes' == $ivan_carousel_nav) { $carouselCode .= ',navigation: true, navigationText: [\'<i class="fa fa-angle-left"></i>\', \'<i class="fa fa-angle-right"></i>\']'; } if ('yes' == $ivan_carousel_bullets) { $carouselCode .= ',pagination: true'; } else { $carouselCode .= ',pagination: false'; } $carouselCode .= '});'; $output .= ' var _carousel = jQuery(".' . $_prefix . ' .owl-carousel"); var _navH = 0; '; $output .= $carouselCode; if ('yes' == $ivan_carousel_nav) { if ('yes' == $ivan_carousel_bullets) { $output .= ' _carousel.find(".owl-controls").each(function() { _navH = jQuery(this).outerHeight(true) / 2; }); '; } $output .= ' _carousel.find(".owl-buttons div").each(function(){ var _h = (jQuery(this).outerHeight() / 2) + _navH; jQuery(this).css("margin-top", "-" + _h + "px" ); }); '; } } if (is_admin()) { $output .= '} /* Ends owlCarousel function check... */'; } $output .= '});</script>'; wp_reset_query(); } // #end main query $style = ''; foreach ($this->selectors as $key => $value) { if (isset($atts[$key]) && '' != $atts[$key]) { $style .= ivan_vc_customizer_get_style($atts[$key], $this->selectors[$key], $this->prefix); } } // Print style if (is_admin()) { $output .= '<style type="text/css">' . $style . '</style>'; } else { $ivan_custom_css .= $style; } return $output; }
} if ($animation) { $attrs['data-animation'] = $animation; } if ($animation_delay) { $attrs['data-animation-delay'] = floatval($animation_delay); } if (is_front_page() || is_home()) { $paged = get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1); } else { $paged = get_query_var('paged') ? get_query_var('paged') : 1; } if ($count != '' && !is_numeric($count)) { $count = -1; } list($query_args, $loop) = vc_build_loop_query($posts_query); $query_args['paged'] = intval($paged); $query_args['has_password'] = false; $query_args['ignore_sticky_posts'] = 1; $query_args['posts_per_page'] = intval($count); $blog_posts = new WP_Query($query_args); $col_class = 'col-md-' . absint(floor(12 / intval($columns))); ?> <div<?php echo wyde_get_attributes($attrs); ?> > <?php if ($title || $content) { ?>
<?php /** * Blog Posts * * Laborator.co * www.laborator.co */ if (function_exists('vc_map_get_attributes')) { $atts = vc_map_get_attributes($this->getShortcode(), $atts); } extract($atts); list($query_args, $blog_query) = vc_build_loop_query($blog_query); $unique_id = 'blogposts-' . mt_rand(1000, 10000); if (function_exists('uniqid')) { $unique_id .= uniqid(); } $is_masonry = false; $columns_class = ''; $columns_count = intval($columns); $more_link = vc_build_link($more_link); $blog_posts_options = explode(',', $blog_posts_options); switch ($masonry) { case 'masonry': case 'packery': case 'fitRows': $is_masonry = true; break; } switch ($columns) { case '1':
global $vc_teaser_box; $posts_query = $el_class = $args = $my_query = $speed = $mode = $swiper_options = ''; $content = $link = $layout = $thumb_size = $link_target = $slides_per_view = $wrap = ''; $autoplay = $hide_pagination_control = $hide_prev_next_buttons = $title = ''; $posts = array(); extract(shortcode_atts(array('el_class' => '', 'posts_query' => '', 'mode' => 'horizontal', 'speed' => '5000', 'slides_per_view' => '1', 'swiper_options' => '', 'wrap' => '', 'autoplay' => 'no', 'hide_pagination_control' => '', 'hide_prev_next_buttons' => '', 'layout' => 'title,thumbnail,excerpt', 'link_target' => '', 'thumb_size' => 'thumbnail', 'partial_view' => '', 'title' => ''), $atts)); global $vc_posts_grid_exclude_id; $vc_posts_grid_exclude_id[] = get_the_ID(); // fix recursive nesting if (is_array($posts_query)) { $posts_query['post_status'] = 'publish'; } else { $posts_query .= '|post_status:publish'; } list($args, $my_query) = vc_build_loop_query($posts_query, get_the_ID()); $teaser_blocks = vc_sorted_list_parse_value($layout); /** @var $my_query WP_Query */ while ($my_query->have_posts()) { $my_query->the_post(); // Get post from query if (in_array(get_the_ID(), $vc_posts_grid_exclude_id)) { continue; } $post = new stdClass(); // Creating post object. $post->id = get_the_ID(); $post->link = get_permalink($post->id); $post->post_type = get_post_type(); if ($vc_teaser_box->getTeaserData('enable', $post->id) === '1') { $post->custom_user_teaser = true;
# Rebuild query params for Masonry Portfolio if (isset($lab_masonry_portfolio) && $lab_masonry_portfolio == true) { $portfolio_query = 'size:-1|order_by:post__in|post_type:portfolio|by_id:0'; foreach ($lab_vc_portfolio_items_details as $item) { $portfolio_query .= ",{$item['portfolio_id']}"; } // Remove post type ordering if (function_exists('CPTOrderPosts')) { remove_filter('posts_orderby', 'CPTOrderPosts', 99, 2); $cpto_posts_orderby_removed = true; } } // Retrieve portfolio main details include locate_template('tpls/portfolio-query.php'); // Portfolio Masonry Query list($query_args, $tmp_query) = vc_build_loop_query($portfolio_query); $query_args['meta_key'] = '_thumbnail_id'; $portfolio_query = new WP_Query($query_args); // Revert back post ordering filter if (function_exists('CPTOrderPosts') && isset($cpto_posts_orderby_removed) && $cpto_posts_orderby_removed) { add_filter('posts_orderby', 'CPTOrderPosts', 99, 2); $cpto_posts_orderby_removed = false; } $more_link = vc_build_link($more_link); # Enqueue Scrips wp_enqueue_script('isotope'); # Portfolio Vars $columns_count = isset($columns) ? $columns : 'four'; if ($portfolio_type == 'type-2' && $portfolio_spacing != 'inherit') { $portfolio_type_2_grid_spacing = $portfolio_spacing == 'yes' ? 'normal' : 'merged'; }