本文整理汇总了PHP中vc_build_loop_query函数的典型用法代码示例。如果您正苦于以下问题:PHP vc_build_loop_query函数的具体用法?PHP vc_build_loop_query怎么用?PHP vc_build_loop_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vc_build_loop_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
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);
}
示例2: getLoop
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);
}
示例3: content
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);
}
示例4: 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);
}
示例5: 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);
}
示例6: getLoop
protected function getLoop($loop)
{
list($this->loop_args, $this->query) = vc_build_loop_query($loop, get_the_ID());
}
示例7: array
<?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') {
示例8: content
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,
//.........这里部分代码省略.........
示例9: getLoop
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() );
}
示例10: widget
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>';
//.........这里部分代码省略.........
示例11: content
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>
//.........这里部分代码省略.........
示例12: shortcode_atts
* @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();
?>
示例13: extract
<?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);
}
示例14: array
<?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) {
示例15: content
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';
}
}
}
}
}
//.........这里部分代码省略.........