function rehub_most_popular_widget_block($basedby = 'hot', $sortby = '', $number = 5) { ?> <?php if ($sortby == 'this_week') { if (!function_exists('filter_where_week')) { function filter_where_week($where = '') { //posts in the last 7 days $where .= " AND post_date > '" . date('Y-m-d', strtotime('-7 days')) . "'"; return $where; } } add_filter('posts_where', 'filter_where_week'); } elseif ($sortby == 'this_month') { if (!function_exists('filter_where_month')) { function filter_where_month($where = '') { //posts in the last 30 days $where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'"; return $where; } } add_filter('posts_where', 'filter_where_month'); } elseif ($sortby == 'three_month') { if (!function_exists('filter_where_t_month')) { function filter_where_t_month($where = '') { //posts in the last 30 days $where .= " AND post_date > '" . date('Y-m-d', strtotime('-90 days')) . "'"; return $where; } } add_filter('posts_where', 'filter_where_t_month'); } else { } global $post; if ($basedby == 'hot') { $popular_posts = new WP_Query('showposts=' . $number . '&meta_key=post_hot_count&orderby=meta_value_num&order=DESC&ignore_sticky_posts=1'); } elseif ($basedby == 'views') { $popular_posts = new WP_Query('showposts=' . $number . '&meta_key=rehub_views&orderby=meta_value_num&order=DESC&ignore_sticky_posts=1'); } else { $popular_posts = new WP_Query('showposts=' . $number . '&orderby=comment_count&order=DESC&ignore_sticky_posts=1'); } if ($popular_posts->have_posts()) { ?> <?php while ($popular_posts->have_posts()) { $popular_posts->the_post(); ?> <div class="clearfix"> <figure><a href="<?php the_permalink(); ?> "><?php wpsm_thumb('med_thumbs'); ?> </a></figure> <div class="detail"> <h5><?php if ($basedby == 'hot') { echo getHotLikeTitle(get_the_ID()); } ?> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h5> <div class="rcnt_meta"> <?php $category = get_the_category($post->ID); $first_cat = $category[0]->term_id; ?> <?php if ($basedby == 'views') { meta_small(false, $first_cat, false, true); } else { meta_small(false, $first_cat, true, false); } ?> </div> <?php $quick_price = get_post_meta(get_the_ID(), 'rehub_offer_product_price', true); $egg_price = get_post_meta(get_the_ID(), 'affegg_product_price', true); if (!empty($quick_price)) { echo '<span class="price_count">' . $quick_price . '</span>'; } elseif (!empty($egg_price)) { $re_egg_currency = get_post_meta(get_the_ID(), 'affegg_product_currency', true); $types = array("RUB" => "руб.", "UAH" => "грн.", "USD" => "\$", "CAD" => "\$", "GBP" => "£", "EUR" => "€", "JPY" => "¥", "CNY" => "¥", "INR" => "₹"); if (key_exists($re_egg_currency, $types)) { $re_egg_currency = $types[$re_egg_currency]; } echo '<span class="price_count">' . $re_egg_currency . $egg_price . '</span>'; } ?> </div> </div> <?php } ?> <?php wp_reset_query(); ?> <?php } remove_filter('posts_where', 'filter_where_month'); remove_filter('posts_where', 'filter_where_t_month'); remove_filter('posts_where', 'filter_where_week'); ?> <?php }
" alt="<?php the_title_attribute(); ?> " class="img_centered" /> <?php } ?> </a> <?php } ?> </figure> <div class="wrap_thing"> <div class="hover_anons"> <h2><?php echo getHotLikeTitle(get_the_ID()); ?> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <p><?php kama_excerpt('maxchar=320'); ?> </p> </div> <?php if (vp_metabox('rehub_post_side.disable_top_offer') != '1') {