protected function display_posts_filter($args = array()) { $default_args = array('post_type' => 'post', 'taxonomy' => 'category', 'query' => null, 'select' => 'all', 'show_category_filter' => true); $args = wp_parse_args($args, $default_args); $filter_args = array(); if ($args['show_category_filter']) { // categorizer args $filter_args = array('taxonomy' => $args['taxonomy'], 'post_type' => $args['post_type'], 'select' => $args['select']); if ('only' == $args['select'] && $args['query'] && $args['query']->have_posts()) { foreach ($args['query']->posts as $p) { $p_ids[] = $p->ID; } // get posts terms $terms_ids = wp_get_object_terms($p_ids, $args['taxonomy'], array('fields' => 'ids')); $terms_ids = array_unique($terms_ids); $filter_args['terms'] = $terms_ids; } } // display categorizer presscore_get_category_list(array('data' => dt_prepare_categorizer_data($filter_args), 'class' => 'filter iso-filter')); }
protected function display_posts_filter($args = array()) { $default_args = array('post_type' => 'post', 'taxonomy' => 'category', 'query' => null, 'select' => 'all', 'show_category_filter' => true); $args = wp_parse_args($args, $default_args); $filter_args = array(); if ($args['show_category_filter']) { // categorizer args $filter_args = array('taxonomy' => $args['taxonomy'], 'post_type' => $args['post_type'], 'select' => $args['select']); if ('only' == $args['select'] && $args['query'] && $args['query']->posts && isset($args['query']->tax_query->queried_terms[$args['taxonomy']]['terms'])) { $filter_args['terms'] = array(); $queried_terms = $args['query']->tax_query->queried_terms[$args['taxonomy']]['terms']; $posts_ids = wp_list_pluck($args['query']->posts, 'ID'); $posts_terms = wp_get_object_terms($posts_ids, $args['taxonomy']); foreach ($posts_terms as $term) { if (in_array($term->slug, $queried_terms)) { $filter_args['terms'][] = intval($term->term_id); } } $filter_args['terms'] = array_unique($filter_args['terms']); } } // display categorizer presscore_get_category_list(array('data' => dt_prepare_categorizer_data($filter_args), 'class' => 'filter iso-filter')); }
if (!$config->get('show_ordering')) { remove_filter('presscore_get_category_list', 'presscore_add_sorting_for_category_list', 15); } if ($config->get('show_filter')) { $posts_ids = $terms_ids = array(); $select = $display['select']; if ('category' == $display['type']) { $terms_ids = empty($display['terms_ids']) ? array() : $display['terms_ids']; } elseif ('albums' == $display['type']) { $posts_ids = isset($display['posts_ids']) ? $display['posts_ids'] : array(); } // categorizer args $filter_args = array('taxonomy' => 'dt_gallery_category', 'post_type' => 'dt_gallery', 'select' => $select, 'terms' => $terms_ids, 'post_ids' => $posts_ids); } // display categorizer presscore_get_category_list(array('data' => dt_prepare_categorizer_data($filter_args), 'class' => 'filter without-isotope' . $ajax_class)); ?> <?php // masonry layout classes $masonry_container_classes = array('wf-container' . $ajax_class, 'portfolio-grid', 'jg-container'); // hover classes switch ($config->get('description')) { case 'on_hoover_centered': $masonry_container_classes[] = 'hover-style-two'; case 'on_hoover': if ('dark' == $config->get('hover_bg_color')) { $masonry_container_classes[] = 'hover-color-static'; } if ('move_to' == $config->get('hover_animation')) { $masonry_container_classes[] = 'cs-style-1';
function presscore_display_posts_filter($args = array()) { $default_args = array('post_type' => 'post', 'taxonomy' => 'category', 'query' => null); $args = wp_parse_args($args, $default_args); $config = presscore_get_config(); $load_style = $config->get('load_style'); // categorizer $filter_args = array(); if ($config->get('template.posts_filter.terms.enabled')) { // $posts_ids = $terms_ids = array(); $display = $config->get('display'); $select = $display['select']; // categorizer args $filter_args = array('taxonomy' => $args['taxonomy'], 'post_type' => $args['post_type'], 'select' => $select); if ('default' == $load_style && 'masonry' == $config->get('layout')) { if ($args['query'] && $args['query']->have_posts()) { foreach ($args['query']->posts as $p) { $p_ids[] = $p->ID; } // get posts terms $terms_ids = wp_get_object_terms($p_ids, $args['taxonomy'], array('fields' => 'ids')); $terms_ids = array_unique($terms_ids); $filter_args['terms'] = $terms_ids; } $filter_args['select'] = 'only'; } elseif ('category' == $display['type']) { $terms_ids = empty($display['terms_ids']) ? array() : $display['terms_ids']; $filter_args['terms'] = $terms_ids; } elseif ('albums' == $display['type']) { $posts_ids = isset($display['posts_ids']) ? $display['posts_ids'] : array(); $filter_args['post_ids'] = $posts_ids; } } $filter_class = ''; if ('default' != $load_style) { $filter_class .= ' with-ajax'; } else { $filter_class .= ' without-isotope'; } // display categorizer presscore_get_category_list(array('data' => dt_prepare_categorizer_data($filter_args), 'class' => 'filter' . $filter_class)); }
function presscore_display_posts_filter($args = array()) { $default_args = array('post_type' => 'post', 'taxonomy' => 'category', 'query' => null); $args = wp_parse_args($args, $default_args); $config = presscore_get_config(); $load_style = $config->get('load_style'); // categorizer $filter_args = array(); if ($config->get('template.posts_filter.terms.enabled')) { // $posts_ids = $terms_ids = array(); $default_display = array('select' => 'all', 'type' => 'category', 'terms_ids' => array(), 'posts_ids' => array()); $display = wp_parse_args($config->get('display'), $default_display); // categorizer args $filter_args = array('taxonomy' => $args['taxonomy'], 'post_type' => $args['post_type'], 'select' => $display['select']); if ('category' == $display['type']) { $terms_ids = empty($display['terms_ids']) ? array() : $display['terms_ids']; $filter_args['terms'] = $terms_ids; } elseif ('albums' == $display['type']) { $posts_ids = isset($display['posts_ids']) ? $display['posts_ids'] : array(); $filter_args['post_ids'] = $posts_ids; } } $filter_class = ''; if ('default' !== $load_style) { $filter_class .= ' with-ajax'; } else { $filter_class .= ' without-isotope'; } if (!$config->get('template.posts_filter.orderby.enabled') && !$config->get('template.posts_filter.order.enabled')) { $filter_class .= ' extras-off'; } // display categorizer presscore_get_category_list(array('data' => dt_prepare_categorizer_data($filter_args), 'class' => 'filter' . $filter_class)); }