Esempio n. 1
0
File: html.php Progetto: hikaram/wee
 public static function get_item_posts_count($page_meta_data_filter, $meta_key, $meta_value, $slug, $html_type)
 {
     $post_count = 0;
     global $wpdb;
     //+++
     if (self::is_page_mdf_data()) {
         list($meta_query_array, $filter_post_blocks_data, $widget_options) = self::get_meta_query_array($page_meta_data_filter);
         $show_items_count_dynam = isset($widget_options['show_items_count_dynam']) ? $widget_options['show_items_count_dynam'] : 0;
         //if count tax items we need to ask next param
         if ($html_type == 'tax_item') {
             $show_items_count_dynam = isset($widget_options['taxonomies_options_post_recount_dyn']) ? $widget_options['taxonomies_options_post_recount_dyn'] : 0;
         }
         if ($show_items_count_dynam == 1) {
             //process ******************************************************
             $in_array = false;
             $pos_in_array = 0;
             //to remove item if it is in $meta_query_array
             if (!empty($meta_query_array)) {
                 foreach ($meta_query_array as $k => $value) {
                     if ($value['key'] == $meta_key) {
                         $in_array = true;
                         $pos_in_array = $k;
                         break;
                     }
                 }
             }
             //+++
             if ($html_type != 'tax_item') {
                 switch ($html_type) {
                     case 'checkbox':
                         if (!$in_array) {
                             $meta_query_array[] = array('key' => $meta_key, 'value' => 1, 'compare' => '=');
                         }
                         break;
                     case 'select':
                         //we have to exclude all siblings keys in current select
                         if ($in_array) {
                             unset($meta_query_array[$pos_in_array]);
                         }
                         //look in range (0-500, 501-1000, 1001-2000 and etc...)
                         $tmp = explode('-', $meta_value);
                         $is_range = MDTF_HELPER::is_slider_range_value($tmp);
                         //+++
                         if ($is_range) {
                             $meta_query_array[] = array('key' => "{$meta_key}", 'value' => floatval($tmp[0]), 'compare' => ">=", 'type' => 'DECIMAL');
                             $meta_query_array[] = array('key' => "{$meta_key}", 'value' => floatval($tmp[1]), 'compare' => "<=", 'type' => 'DECIMAL');
                         } else {
                             //and add itself
                             $meta_query_array[] = array('key' => $meta_key, 'value' => $meta_value, 'compare' => '=');
                         }
                         break;
                     case 'slider':
                         break;
                     default:
                         break;
                 }
             }
             //+++
             $tax_query_array = array();
             //+++
             $mdf_tax_bool = isset($_REQUEST['mdf_tax_bool']) ? $_REQUEST['mdf_tax_bool'] : 'AND';
             if (isset($page_meta_data_filter['taxonomy'])) {
                 $tax_query_array = self::get_tax_query_array($page_meta_data_filter['taxonomy']);
             }
             $tax_query_array = apply_filters('mdf_filter_taxonomies2', $tax_query_array);
             //+++
             //AND empty($tax_query_array) - if only taxonomies in search form
             if (isset($_REQUEST['mdf_cat'])) {
                 $tmp_add = true;
                 if (empty($meta_query_array)) {
                     $tmp_add = true;
                 }
                 $hide_meta_filter_values = isset($widget_options['hide_meta_filter_values']) ? $widget_options['hide_meta_filter_values'] : false;
                 if ($hide_meta_filter_values) {
                     $tmp_add = false;
                 }
                 if ($tmp_add) {
                     if (isset($_REQUEST['mdf_cat']) and $_REQUEST['mdf_cat'] > 0) {
                         $meta_query_array[] = array('key' => "meta_data_filter_cat", 'value' => $_REQUEST['mdf_cat'], 'compare' => '=');
                     }
                 }
             }
             $meta_data_filter_bool = isset($_REQUEST['meta_data_filter_bool']) ? $_REQUEST['meta_data_filter_bool'] : 'AND';
             if (!empty($meta_query_array)) {
                 $meta_query_array = array_merge(array('relation' => $meta_data_filter_bool), $meta_query_array);
             }
             //for WOOCOMMERCE hidden products ***
             if ($slug == 'product' and class_exists('WooCommerce')) {
                 $buffer = array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN');
                 if (empty($meta_query_array)) {
                     $meta_query_array = array_merge(array('relation' => $meta_data_filter_bool), $buffer);
                 } else {
                     $meta_query_array[] = $buffer;
                 }
                 //for out stock products
                 if (self::get_setting('exclude_out_stock_products')) {
                     $buffer = array('key' => '_stock_status', 'value' => array('instock'), 'compare' => 'IN');
                     $meta_query_array[] = $buffer;
                 }
                 //***
             }
             //+++
             //Trick - how to hide post from search
             if (empty($meta_query_array)) {
                 $meta_query_array = array_merge(array('relation' => $meta_data_filter_bool), array('key' => 'mdf_hide_post', 'value' => 'out', 'compare' => 'NOT EXISTS'));
             } else {
                 $meta_query_array[] = array('key' => 'mdf_hide_post', 'value' => 'out', 'compare' => 'NOT EXISTS');
             }
             //***
             if (!empty($tax_query_array)) {
                 $tax_query_array = array_merge(array('relation' => $mdf_tax_bool), $tax_query_array);
             }
             $args = array('post_type' => $slug, 'meta_query' => $meta_query_array, 'tax_query' => $tax_query_array, 'post_status' => array('publish'), 'nopaging' => true, 'fields' => 'ids', 'ignore_sticky_posts' => self::get_setting('ignore_sticky_posts'), 'suppress_filters' => false, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, 'cache_results' => false, 'showposts' => false, 'comments_popup' => false);
             //WPML compatibility
             if (class_exists('SitePress')) {
                 $args['lang'] = ICL_LANGUAGE_CODE;
             }
             $counter_obj = new WP_QueryMDFCounter($args);
             $post_count = $counter_obj->post_count;
         }
     }
     //****************
     if ($html_type != 'tax_item') {
         if (!self::is_page_mdf_data() or isset($widget_options['show_items_count_dynam']) and $widget_options['show_items_count_dynam'] == 0) {
             //if we are not on search page or NO show_items_count_dynam
             $meta_query_array = array();
             switch ($html_type) {
                 case 'slider':
                     //http://codex.wordpress.org/Class_Reference/WP_Meta_Query
                     /*
                      $meta_query_array[] = array(
                      'key'=>$meta_key,
                      //'value'=>array($meta_value[0], $meta_value[1]),
                      'value'=>array( $meta_value[0], self::$max_int ),
                      'type'=>'DECIMAL',
                      'compare'=>'BETWEEN'
                      );
                     */
                     $meta_query_array[] = self::range_slider_multicontroller($slug, $meta_key, $meta_value[0], self::$max_int);
                     break;
                 case 'select':
                     $tmp = explode('-', $meta_value);
                     $is_range = MDTF_HELPER::is_slider_range_value($tmp);
                     //+++
                     if ($is_range) {
                         $meta_query_array[] = array('key' => "{$meta_key}", 'value' => floatval($tmp[0]), 'compare' => ">=", 'type' => 'DECIMAL');
                         $meta_query_array[] = array('key' => "{$meta_key}", 'value' => floatval($tmp[1]), 'compare' => "<=", 'type' => 'DECIMAL');
                     } else {
                         $meta_query_array[] = array('key' => "{$meta_key}", 'value' => "{$meta_value}", 'compare' => '=');
                     }
                     break;
                 default:
                     $meta_query_array[] = array('key' => "{$meta_key}", 'value' => "{$meta_value}", 'compare' => '=');
                     break;
             }
             //for WOOCOMMERCE hidden products ***
             if ($slug == 'product' and class_exists('WooCommerce')) {
                 $buffer = array('key' => '_visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN');
                 if (empty($meta_query_array)) {
                     $meta_query_array = array_merge(array('relation' => $meta_data_filter_bool), $buffer);
                 } else {
                     $meta_query_array[] = $buffer;
                 }
                 //for out stock products
                 if (self::get_setting('exclude_out_stock_products')) {
                     $buffer = array('key' => '_stock_status', 'value' => array('instock'), 'compare' => 'IN');
                     $meta_query_array[] = $buffer;
                 }
                 //***
             }
             //+++
             //Trick - how to hide post from search
             if (empty($meta_query_array)) {
                 $meta_query_array = array_merge(array('relation' => $meta_data_filter_bool), array('key' => 'mdf_hide_post', 'value' => 'out', 'compare' => 'NOT EXISTS'));
             } else {
                 $meta_query_array[] = array('key' => 'mdf_hide_post', 'value' => 'out', 'compare' => 'NOT EXISTS');
             }
             //***
             $tax_query_array = apply_filters('mdf_filter_taxonomies', array());
             $tax_query_array = apply_filters('mdf_filter_taxonomies2', $tax_query_array);
             //count data for selected mdf_cat
             if (isset($_REQUEST['meta_data_filter_cat_form'])) {
                 $tmp_add = true;
                 if (empty($meta_query_array)) {
                     $tmp_add = false;
                 }
                 if ($tmp_add) {
                     if (isset($_REQUEST['mdf_cat']) and $_REQUEST['mdf_cat'] > 0) {
                         $meta_query_array[] = array('key' => "meta_data_filter_cat", 'value' => isset($_REQUEST['mdf_cat']) ? $_REQUEST['mdf_cat'] : $_REQUEST['meta_data_filter_cat_form'], 'compare' => '=');
                     }
                 }
             }
             //***
             $args = array('post_type' => $slug, 'meta_query' => $meta_query_array, 'tax_query' => $tax_query_array, 'post_status' => array('publish'), 'nopaging' => true, 'fields' => 'ids', 'ignore_sticky_posts' => self::get_setting('ignore_sticky_posts'), 'suppress_filters' => false, 'update_post_term_cache' => false, 'update_post_meta_cache' => false, 'cache_results' => false, 'showposts' => false, 'comments_popup' => false);
             //WPML compatibility
             if (class_exists('SitePress')) {
                 $args['lang'] = ICL_LANGUAGE_CODE;
             }
             $counter_obj = new WP_QueryMDFCounter($args);
             $post_count = $counter_obj->post_count;
         }
     }
     return $post_count;
 }
Esempio n. 2
0
?>
</th>
        </tr>
    </thead>
    <tbody>
        <?php 
while ($mdf_loop->have_posts()) {
    $mdf_loop->the_post();
    ?>
            <tr>
                <td style="width: 30%;">
                    <a href="<?php 
    the_permalink();
    ?>
" target="_blank" class="thumbnail alignleft"><img src="<?php 
    echo MDTF_HELPER::get_post_featured_image($post->ID, '120x100');
    ?>
" alt="<?php 
    the_title();
    ?>
" /></a><br />
                    <strong><a href="<?php 
    the_permalink();
    ?>
" target="_blank"><?php 
    the_title();
    ?>
</a></strong><br />
                    <div style="clear: both;"></div>
                    <?php 
    echo do_shortcode('[mdf_post_features_panel]');
Esempio n. 3
0
echo do_shortcode('[mdf_gmap height="300" width="100" zoom="' . $zoom . '" maptype="TERRAIN" metakey="medafi_map"]');
echo '<br />';
MDTF_SORT_PANEL::mdtf_catalog_ordering();
?>

<div class="row previews">
    <?php 
while ($mdf_loop->have_posts()) {
    $mdf_loop->the_post();
    ?>
        <div class="col-lg-6">
            <div class="thumbnail">
                <?php 
    if (has_post_thumbnail($post->ID)) {
        echo '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr($post->post_title) . '">';
        echo '<img src="' . MDTF_HELPER::get_post_featured_image($post->ID, '500x300') . '" alt="" />';
        echo '</a>';
    }
    ?>
                <div class="caption" style="max-height: 650px;">
                    <h3><a href="<?php 
    the_permalink();
    ?>
" target="_blank"><?php 
    the_title();
    ?>
</a></h3>

                    <p style="text-align: center;">
                        <?php 
    echo do_shortcode('[inpost_fancy thumb_width="50" thumb_height="50" post_id="' . $post->ID . '" thumb_margin_left="5" thumb_margin_bottom="5" thumb_border_radius="200" thumb_shadow="0 1px 4px rgba(0, 0, 0, 0.2)" id="" random="0" group="0" border="" show_in_popup="0" album_cover="" album_cover_width="200" album_cover_height="200" popup_width="800" popup_max_height="600" popup_title="Gallery" type="fancy" sc_id="sc1413390928195"]');
Esempio n. 4
0
        <td><?php 
_e('View', 'meta-data-filter');
?>
</td>
    </tr>
    <?php 
while ($mdf_loop->have_posts()) {
    $mdf_loop->the_post();
    ?>
        <tr>
            <td style="width: 30%;">
                <a href="<?php 
    the_permalink();
    ?>
" target="_blank" class="thumbnail alignleft"><img src="<?php 
    echo MDTF_HELPER::get_post_featured_image($post->ID, '200x180');
    ?>
" alt="<?php 
    the_title();
    ?>
" /></a><br />
                <strong><a href="<?php 
    the_permalink();
    ?>
" target="_blank"><?php 
    the_title();
    ?>
</a></strong><br />
                <div style="clear: both;"></div>
                <?php 
    echo do_shortcode('[mdf_post_features_panel]');
Esempio n. 5
0
            }
            //+++
            if ($widget_options['show_slider_items_count']) {
                $items_count = MetaDataFilterHtml::get_item_posts_count($page_meta_data_filter, $search_key, array($min, $max), $slug, 'slider');
                if (!$items_count) {
                    if ($widget_options['hide_items_where_count_0']) {
                        //continue; //IF NO ONE ITEM WHY NOT TO HIDE THIS?!
                    }
                }
            }
            //+++
            ?>
                        <td>
                            <?php 
            if ($search_key === '_price' and (isset($item['woo_price_auto']) and $item['woo_price_auto'] == 1)) {
                $mm = MDTF_HELPER::get_woo_min_max_price();
                if (!empty($mm)) {
                    $preset_max = $mm['max'];
                    $preset_min = $mm['min'];
                    if (!self::is_page_mdf_data()) {
                        $max = $mm['max'];
                        $min = $mm['min'];
                    }
                }
            }
            ?>
                            <div class="mdf_input_container mdf_slider_<?php 
            echo $key;
            ?>
">
Esempio n. 6
0
global $mdf_loop;
MDTF_SORT_PANEL::mdtf_catalog_ordering();
?>

<div class="row previews">
    <?php 
while ($mdf_loop->have_posts()) {
    $mdf_loop->the_post();
    ?>
        <div class="col-lg-6">
            <div class="thumbnail">
                <a href="<?php 
    the_permalink();
    ?>
" target="_blank" class="thumbnail alignleft"><img src="<?php 
    echo MDTF_HELPER::get_post_featured_image($post->ID, '280x220');
    ?>
" alt="<?php 
    the_title();
    ?>
" /></a>

                <div class="caption" style="max-height: 650px;">
                    <h3><a href="<?php 
    the_permalink();
    ?>
" target="_blank"><?php 
    the_title();
    ?>
</a></h3>