当前位置: 首页>>代码示例>>PHP>>正文


PHP Essential_Grid_Base::get_all_gallery_images方法代码示例

本文整理汇总了PHP中Essential_Grid_Base::get_all_gallery_images方法的典型用法代码示例。如果您正苦于以下问题:PHP Essential_Grid_Base::get_all_gallery_images方法的具体用法?PHP Essential_Grid_Base::get_all_gallery_images怎么用?PHP Essential_Grid_Base::get_all_gallery_images使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Essential_Grid_Base的用法示例。


在下文中一共展示了Essential_Grid_Base::get_all_gallery_images方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: output_by_specific_posts


//.........这里部分代码省略.........
     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']);
                         break;
                     case 'content-gallery':
                         $lb_add_images = $base->get_all_gallery_images($post['post_content'], true);
                         break;
                     case 'woocommerce-gallery':
                         $lb_add_images = array();
                         if (Essential_Grid_Woocommerce::is_woo_exists()) {
                             $lb_add_images = Essential_Grid_Woocommerce::get_image_attachements($post['ID'], true);
                         }
                         break;
                 }
                 $item_skin->set_lightbox_addition(array('items' => $lb_add_images, 'base' => $lightbox_include_media));
             }
             $item_skin->set_filter($filters);
             $item_skin->set_media_sources($post_media_source_data);
             $item_skin->set_media_sources_type($post_media_source_type);
             $item_skin->set_video_ratios($post_video_ratios);
             $item_skin->set_post_values($post);
             $item_skin->set_load_more();
             //switch to different skin
             $use_item_skin_id = json_decode(get_post_meta($post['ID'], 'eg_use_skin', true), true);
             if ($use_item_skin_id !== false && isset($use_item_skin_id[$this->grid_id]['use-skin'])) {
                 $use_item_skin_id = $use_item_skin_id[$this->grid_id]['use-skin'];
             } else {
                 $use_item_skin_id = -1;
             }
             $use_item_skin_id = apply_filters('essgrid_modify_post_item_skin', $use_item_skin_id, $post, $this->grid_id);
             $item_skin->switch_item_skin($use_item_skin_id);
             $item_skin->register_layer_css();
             $item_skin->register_skin_css();
             ob_start();
             $item_skin->output_item_skin();
             $skins_html .= ob_get_contents();
             ob_clean();
             ob_end_clean();
         }
     } else {
         return false;
     }
     return $skins_html;
 }
开发者ID:kfwebdev,项目名称:wp-atd,代码行数:101,代码来源:essential-grid.class.php


注:本文中的Essential_Grid_Base::get_all_gallery_images方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。