public function setItemsIfEmpty($items)
 {
     if (empty($items)) {
         require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php');
         $grid_item = new Vc_Grid_Item();
         $grid_item->setGridAttributes($this->atts);
         $grid_item->shortcodes();
         $item = '[vc_gitem]<img src="' . vc_asset_url('vc/vc_gitem_image.png') . '">[/vc_gitem]';
         $grid_item->parseTemplate($item);
         $items = str_repeat($grid_item->renderItem(get_post((int) vc_request_param('vc_post_id'))), 3);
     }
     return $items;
 }
 private function renderItems()
 {
     $output = $items = '';
     $this->buildGridSettings();
     $css_classes = 'vc_row vc_clearfix vc_grid' . esc_attr($this->atts['gap'] > 0 ? ' vc_grid-gutter-' . (int) $this->atts['gap'] . 'px' : '');
     if (is_array($this->items) && !empty($this->items)) {
         require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php');
         $grid_item = new Vc_Grid_Item();
         $grid_item->setGridAttributes($this->atts);
         $grid_item->setIsEnd(isset($this->is_end) && $this->is_end);
         $grid_item->setTemplateById($this->atts['item']);
         $output .= $grid_item->addShortcodesCustomCss();
         ob_start();
         wp_print_styles();
         $output .= ob_get_clean();
         $output .= vc_get_template('shortcodes/vc_basic_grid_filter.php', array('filter_terms' => $this->filter_terms, 'atts' => $this->atts));
         while (have_posts()) {
             the_post();
             $items .= $grid_item->renderItem(get_post());
         }
         /*
         foreach ( $this->items as $post ) {
         	$post->the_post();
         	$items .= $grid_item->renderItem( $post );
         
         	$items .= trim( vc_get_template( 'shortcodes/vc_grid_item.php', array(
         		'post' => $post,
         		'element_width' => $this->atts['element_width'],
         	) ) );
         */
     }
     $items = apply_filters($this->shortcode . '_items_list', $items);
     $output .= $this->renderPagination($this->atts['style'], $this->grid_settings, $items, $css_classes) . "\n";
     return $output;
 }
Beispiel #3
0
 private function renderItems()
 {
     $output = $items = '';
     $this->buildGridSettings();
     $atts = $this->atts;
     $settings = $this->grid_settings;
     $filter_terms = $this->filter_terms;
     $is_end = isset($this->is_end) && $this->is_end;
     $css_classes = 'vc_grid vc_row' . esc_attr($atts['gap'] > 0 ? ' vc_grid-gutter-' . (int) $atts['gap'] . 'px' : '');
     if (is_array($this->items) && !empty($this->items)) {
         require_once vc_path_dir('PARAMS_DIR', 'vc_grid_item/class-vc-grid-item.php');
         $grid_item = new Vc_Grid_Item();
         $grid_item->setGridAttributes($atts);
         $grid_item->setIsEnd($is_end);
         $grid_item->setTemplateById($atts['item']);
         $output .= $grid_item->addShortcodesCustomCss();
         ob_start();
         wp_print_styles();
         $output .= ob_get_clean();
         $attributes = array('filter_terms' => $filter_terms, 'atts' => $atts, 'grid_item', $grid_item);
         $output .= apply_filters('vc_basic_grid_template_filter', vc_get_template('shortcodes/vc_basic_grid_filter.php', $attributes), $attributes);
         while (have_posts()) {
             the_post();
             $items .= $grid_item->renderItem(get_post());
         }
         wp_reset_postdata();
     }
     $items = apply_filters($this->shortcode . '_items_list', $items);
     $output .= $this->renderPagination($atts['style'], $settings, $items, $css_classes);
     return $output;
 }