本文整理汇总了PHP中Vc_Grid_Item::setTemplateById方法的典型用法代码示例。如果您正苦于以下问题:PHP Vc_Grid_Item::setTemplateById方法的具体用法?PHP Vc_Grid_Item::setTemplateById怎么用?PHP Vc_Grid_Item::setTemplateById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vc_Grid_Item
的用法示例。
在下文中一共展示了Vc_Grid_Item::setTemplateById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderItems
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;
}
示例2: renderItems
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;
}