本文整理汇总了PHP中Essential_Grid_Base::get_posts_by_ids方法的典型用法代码示例。如果您正苦于以下问题:PHP Essential_Grid_Base::get_posts_by_ids方法的具体用法?PHP Essential_Grid_Base::get_posts_by_ids怎么用?PHP Essential_Grid_Base::get_posts_by_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Essential_Grid_Base
的用法示例。
在下文中一共展示了Essential_Grid_Base::get_posts_by_ids方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output_by_specific_posts
/**
* Output by specific posts for load more
*/
public function output_by_specific_posts()
{
$base = new Essential_Grid_Base();
$item_skin = new Essential_Grid_Item_Skin();
$item_skin->grid_id = $this->grid_id;
$item_skin->set_grid_type($base->getVar($this->grid_params, 'layout', 'even'));
$meta_c = new Essential_Grid_Meta();
$item_skin->set_default_image_by_id($base->getVar($this->grid_postparams, 'default-image', 0, 'i'));
$m = new Essential_Grid_Meta();
$start_sortby = $base->getVar($this->grid_params, 'sorting-order-by-start', 'none');
$start_sortby_type = $base->getVar($this->grid_params, 'sorting-order-type', 'ASC');
if (!empty($this->filter_by_ids)) {
$posts = Essential_Grid_Base::get_posts_by_ids($this->filter_by_ids, $start_sortby, $start_sortby_type);
} else {
return false;
}
$item_skin->init_by_id($base->getVar($this->grid_params, 'entry-skin', 0, 'i'));
$order_by = explode(',', $base->getVar($this->grid_params, 'sorting-order-by', 'date'));
if (!is_array($order_by)) {
$order_by = array($order_by);
}
$lazy_load = $base->getVar($this->grid_params, 'lazy-loading', 'off');
if ($lazy_load == 'on') {
$item_skin->set_lazy_load(true);
}
$default_media_source_order = $base->getVar($this->grid_postparams, 'media-source-order', '');
$item_skin->set_default_media_source_order($default_media_source_order);
$default_lightbox_source_order = $base->getVar($this->grid_params, 'lb-source-order', '');
$item_skin->set_default_lightbox_source_order($default_lightbox_source_order);
$lightbox_mode = $base->getVar($this->grid_params, 'lightbox-mode', 'single');
$lightbox_include_media = $base->getVar($this->grid_params, 'lightbox-exclude-media', 'off');
$default_aj_source_order = $base->getVar($this->grid_params, 'aj-source-order', '');
$item_skin->set_default_ajax_source_order($default_aj_source_order);
$post_media_source_type = $base->getVar($this->grid_postparams, 'image-source-type', 'full');
$default_video_poster_order = $base->getVar($this->grid_params, 'poster-source-order', '');
$item_skin->set_default_video_poster_order($default_video_poster_order);
$layout = $base->getVar($this->grid_params, 'layout', 'even');
$layout_sizing = $base->getVar($this->grid_params, 'layout-sizing', 'boxed');
if ($layout_sizing !== 'fullwidth' && $layout == 'masonry') {
$item_skin->set_poster_cropping(true);
}
$skins_html = '';
if ($lightbox_mode == 'content' || $lightbox_mode == 'content-gallery' || $lightbox_mode == 'woocommerce-gallery') {
$item_skin->set_lightbox_rel('ess-' . $this->grid_id);
}
if (!empty($posts) && count($posts) > 0) {
foreach ($posts as $key => $post) {
//check if post should be visible or if its invisible on current grid settings
$is_visible = $this->check_if_visible($post['ID'], $this->grid_id);
if ($is_visible == false) {
continue;
}
// continue if invisible
$post_media_source_data = $base->get_post_media_source_data($post['ID'], $post_media_source_type);
$post_video_ratios = $m->get_post_video_ratios($post['ID']);
$filters = array();
//$categories = get_the_category($post['ID']);
$categories = $base->get_custom_taxonomies_by_post_id($post['ID']);
//$tags = wp_get_post_terms($post['ID']);
$tags = get_the_tags($post['ID']);
if (!empty($categories)) {
foreach ($categories as $key => $category) {
$filters[$category->term_id] = array('name' => $category->name, 'slug' => sanitize_key($category->slug));
}
}
if (!empty($tags)) {
foreach ($tags as $key => $taxonomie) {
$filters[$taxonomie->term_id] = array('name' => $taxonomie->name, 'slug' => sanitize_key($taxonomie->slug));
}
}
$filter_meta_selected = $base->getVar($this->grid_params, 'filter-selected', array());
if (!empty($filter_meta_selected)) {
foreach ($filter_meta_selected as $filter) {
if (strpos($filter, 'meta-') === 0) {
$fil = str_replace('meta-', '', $filter);
$post_filter_meta = $meta_c->get_meta_value_by_handle($post['ID'], 'eg-' . $fil);
$arr = json_decode($post_filter_meta, true);
$cur_filter = is_array($arr) ? $arr : array($post_filter_meta);
//$cur_filter = explode(',', $post_filter_meta);
if (!empty($cur_filter)) {
foreach ($cur_filter as $k => $v) {
if (trim($v) !== '') {
$filters[sanitize_key($v)] = array('name' => $v, 'slug' => sanitize_key($v), 'parent' => '0');
}
}
}
}
}
}
if (is_array($order_by) && !empty($order_by)) {
$sort = $this->prepare_sorting_array_by_post($post, $order_by);
$item_skin->set_sorting($sort);
}
if ($lightbox_mode == 'content' || $lightbox_mode == 'content-gallery' || $lightbox_mode == 'woocommerce-gallery') {
switch ($lightbox_mode) {
case 'content':
$lb_add_images = $base->get_all_content_images($post['ID']);
//.........这里部分代码省略.........