public static function woocommerce_before_shop_loop() { if (!defined('DOING_AJAX')) { if (is_product_taxonomy() or is_shop()) { if (class_exists('MetaDataFilter') and MetaDataFilter::is_page_mdf_data()) { $_REQUEST['mdf_do_not_render_shortcode_tpl'] = true; $_REQUEST['mdf_get_query_args_only'] = true; do_shortcode('[meta_data_filter_results]'); $args = $_REQUEST['meta_data_filter_args']; global $wp_query; $wp_query = new WP_Query($args); $_REQUEST['meta_data_filter_found_posts'] = $wp_query->found_posts; } } } }
} if ($offset != '') { $args['offset'] = $offset; } if (($orderby == 'meta_value' || $orderby == 'meta_value_num') && $meta_key != '') { $args['meta_key'] = $meta_key; } if ($data_source == 'cat' && $cat != '') { $args['cat'] = $cat; } if ($post_formats != 'all') { $args['meta_key'] = 'rehub_framework_post_type'; $args['meta_value'] = $post_formats; } } if (class_exists('MetaDataFilter') and MetaDataFilter::is_page_mdf_data()) { $_REQUEST['mdf_do_not_render_shortcode_tpl'] = true; $_REQUEST['mdf_get_query_args_only'] = true; do_shortcode('[meta_data_filter_results]'); $args = $_REQUEST['meta_data_filter_args']; $wp_query = new WP_Query($args); $_REQUEST['meta_data_filter_found_posts'] = $wp_query->found_posts; } else { $wp_query = new WP_Query($args); } $i = 1; if ($wp_query->have_posts()) { ?> <?php while ($wp_query->have_posts()) {
function wpsm_topcharts_shortcode($atts, $content = null) { extract(shortcode_atts(array('id' => ''), $atts)); if (isset($atts['id']) && $atts['id']) { $topchart = get_post($atts['id']); $type_chart = get_post_meta($topchart->ID, 'top_chart_type', true); $ids_chart = get_post_meta($topchart->ID, 'top_chart_ids', true); $module_ids = explode(',', $ids_chart); $module_width = get_post_meta($topchart->ID, 'top_chart_width', true); $rows = get_post_meta($topchart->ID, 'columncontents', true); //Get the rows ob_start(); ?> <?php if ($module_ids != '') { ?> <?php $query = array('post_status' => 'publish', 'ignore_sticky_posts' => 1, 'orderby' => 'post__in', 'post__in' => $module_ids, 'posts_per_page' => -1); ?> <?php } else { ?> <?php $query = array('posts_per_page' => 5, 'post_status' => 'publish', 'ignore_sticky_posts' => 1); ?> <?php } ?> <?php if (post_type_exists($type_chart)) { $query['post_type'] = $type_chart; } ?> <?php if (class_exists('MetaDataFilter') and MetaDataFilter::is_page_mdf_data()) { $_REQUEST['mdf_do_not_render_shortcode_tpl'] = true; $_REQUEST['mdf_get_query_args_only'] = true; do_shortcode('[meta_data_filter_results]'); $args = $_REQUEST['meta_data_filter_args']; global $wp_query; $wp_query = new WP_Query($args); $_REQUEST['meta_data_filter_found_posts'] = $wp_query->found_posts; } else { $wp_query = new WP_Query($query); } $i = 0; if ($wp_query->have_posts()) { ?> <?php wp_enqueue_script('carouFredSel'); wp_enqueue_script('touchswipe'); ?> <div class="top_chart<?php if ($wp_query->found_posts <= 3) { echo ' table_view_charts'; } ?> "> <div class="top_chart_controls"> <a href="/" class="controls prev"></a> <div class="top_chart_pagination"></div> <a href="/" class="controls next"></a> </div> <div class="top_chart_first"> <ul> <?php if (!empty($rows)) { $nameid = 0; foreach ($rows as $row) { $element_type = $row['column_type']; echo '<li class="row_chart_' . $nameid . ' ' . $element_type . '_row_chart"><div>' . esc_html($row["column_name"]) . '</div></li>'; $nameid++; } } ?> </ul> </div> <div class="top_chart_wrap"><div class="top_chart_carousel"> <?php while ($wp_query->have_posts()) { $wp_query->the_post(); $i++; ?> <div class="top_rating_item top_chart_item" id='rank_<?php echo $i; ?> '> <?php if (vp_metabox('rehub_post_side.is_editor_choice') == '1') { ?> <div class="ed_choice_label"><img src="<?php echo get_template_directory_uri(); ?> /images/editor_badge.png" width="65" height="64" alt=""></div><?php } ?> <ul> <?php if (!empty($rows)) { $pbid = 0; foreach ($rows as $row) { $element = $row['column_type']; echo '<li class="row_chart_' . $pbid . ' ' . $element . '_row_chart">'; if ($element == 'meta_value') { include locate_template('inc/top/metarow.php'); } else { if ($element == 'image') { include locate_template('inc/top/imagerow.php'); } else { if ($element == 'title') { include locate_template('inc/top/titlerow.php'); } else { if ($element == 'taxonomy_value') { include locate_template('inc/top/taxonomyrow.php'); } else { if ($element == 'affiliate_btn') { include locate_template('inc/top/btnrow.php'); } else { if ($element == 'review_link') { include locate_template('inc/top/reviewlinkrow.php'); } else { if ($element == 'review_function') { include locate_template('inc/top/reviewrow.php'); } else { if ($element == 'user_review_function') { include locate_template('inc/top/userreviewcolumn.php'); } else { } } } } } } } } echo '</li>'; $pbid++; } } ?> </ul> </div> <?php } ?> </div></div> </div> <?php } else { _e('No posts for this criteria.', 'rehub_framework'); ?> <?php } ?> <?php wp_reset_query(); ?> <?php $output = ob_get_contents(); ob_end_clean(); return $output; } }