<?php 
            } elseif ($module_desc == 'none') {
                ?>
                        	<?php 
            } else {
                ?>
	
                        		<?php 
                kama_excerpt('maxchar=120');
                ?>
                    		<?php 
            }
            ?>
                        </p>
                        <div class="star"><?php 
            rehub_get_user_results('small', 'yes');
            ?>
</div>
                    </div>
                    <div class="rating_col">
                    <?php 
            if ($rating_circle == '1') {
                ?>
                        <?php 
                $rating_score_clean = rehub_get_overall_score();
                ?>

                        <div class="top-rating-item-circle-view">
                        <div class="radial-progress" data-rating="<?php 
                echo $rating_score_clean;
                ?>
Exemple #2
0
    function wpsm_toprating_shortcode($atts, $content = null)
    {
        extract(shortcode_atts(array('id' => '', 'full_width' => '0'), $atts));
        if (isset($atts['id']) && $atts['id']) {
            $toppost = get_post($atts['id']);
            $module_cats = get_post_meta($toppost->ID, 'top_review_cat', true);
            $module_tag = get_post_meta($toppost->ID, 'top_review_tag', true);
            $module_fetch = get_post_meta($toppost->ID, 'top_review_fetch', true);
            $module_ids = get_post_meta($toppost->ID, 'manual_ids', true);
            $order_choose = get_post_meta($toppost->ID, 'top_review_choose', true);
            $module_desc = get_post_meta($toppost->ID, 'top_review_desc', true);
            $module_desc_fields = get_post_meta($toppost->ID, 'top_review_custom_fields', true);
            $rating_circle = get_post_meta($toppost->ID, 'top_review_circle', true);
            $module_field_sorting = get_post_meta($toppost->ID, 'top_review_field_sort', true);
            $module_order = get_post_meta($toppost->ID, 'top_review_order', true);
            if ($module_fetch == '') {
                $module_fetch = '10';
            }
            if ($module_desc == '') {
                $module_desc = 'post';
            }
            if ($rating_circle == '') {
                $rating_circle = '1';
            }
            ob_start();
            ?>
                <div class="clearfix"></div>

                <?php 
            if ($order_choose == 'cat_choose') {
                ?>
	                <?php 
                $query = array('cat' => $module_cats, 'tag' => $module_tag, 'posts_per_page' => $module_fetch, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => 'rehub_review_overall_score', 'orderby' => 'meta_value_num', 'meta_query' => array(array('key' => 'rehub_framework_post_type', 'value' => 'review', 'compare' => 'LIKE')));
                ?>
 
                    <?php 
                if (!empty($module_field_sorting)) {
                    $query['meta_key'] = $module_field_sorting;
                }
                ?>
                    <?php 
                if ($module_order == 'asc') {
                    $query['order'] = 'ASC';
                }
                ?>
	                
            	<?php 
            } elseif ($order_choose == 'manual_choose' && $module_ids != '') {
                ?>
	                <?php 
                $query = array('post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => -1, 'orderby' => 'post__in', 'post__in' => $module_ids);
                ?>
            	<?php 
            } else {
                ?>
	                <?php 
                $query = array('posts_per_page' => $module_fetch, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'meta_key' => 'rehub_review_overall_score', 'orderby' => 'meta_value_num', 'meta_query' => array(array('key' => 'rehub_framework_post_type', 'value' => 'review', 'compare' => 'LIKE')));
                ?>
                    <?php 
                if (!empty($module_field_sorting)) {
                    $query['meta_key'] = $module_field_sorting;
                }
                ?>
                    <?php 
                if ($module_order == 'asc') {
                    $query['order'] = 'ASC';
                }
                ?>
	                             		
            	<?php 
            }
            ?>
	


                <?php 
            $loop = new WP_Query($query);
            $i = 0;
            if ($loop->have_posts()) {
                ?>
                <div class="top_rating_block<?php 
                if (isset($atts['full_width']) && $atts['full_width'] == '1') {
                    ?>
 full_width_rating<?php 
                } else {
                    ?>
 with_sidebar_rating<?php 
                }
                ?>
 list_style_rating">
                <?php 
                while ($loop->have_posts()) {
                    $loop->the_post();
                    $i++;
                    ?>
     
                    <div class="top_rating_item" id='rank_<?php 
                    echo $i;
                    ?>
'>                    
                        <div class="product_image_col">
                        	<?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_hor_badge.png" width="115" height="36" alt=""></div><?php 
                    }
                    ?>
                            <figure>
                            	<span class="rank_count"><?php 
                    if ($i == '1') {
                        ?>
<i class="fa fa-trophy"></i><?php 
                    } else {
                        echo $i;
                    }
                    ?>
</span>
                            	<a href="<?php 
                    the_permalink();
                    ?>
">
		                            <?php 
                    $img = get_post_thumb();
                    $nothumb = get_template_directory_uri() . '/images/default/noimage_100_70.png';
                    if (rehub_option('aq_resize_crop') == '1') {
                        $params = array('width' => 100);
                    } else {
                        $params = array('width' => 100, 'height' => 100, 'crop' => true);
                    }
                    ?>
		                            <?php 
                    if (!empty($img)) {
                        ?>
		                                <img src="<?php 
                        echo bfi_thumb($img, $params);
                        ?>
" alt="<?php 
                        the_title_attribute();
                        ?>
" />
		                            <?php 
                    } else {
                        ?>
    
		                                <img src="<?php 
                        echo $nothumb;
                        ?>
" alt="<?php 
                        the_title_attribute();
                        ?>
" />
		                            <?php 
                    }
                    ?>
                            	</a>
                            </figure>
                        </div>                            
                    <div class="desc_col">
                        <h2><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h2>
                        <p>
                        	<?php 
                    if ($module_desc == 'post') {
                        ?>
                        		<?php 
                        kama_excerpt('maxchar=120');
                        ?>
                        	<?php 
                    } elseif ($module_desc == 'review') {
                        ?>
                        		<?php 
                        echo wp_kses_post(vp_metabox('rehub_post.review_post.0.review_post_summary_text'));
                        ?>
                            <?php 
                    } elseif ($module_desc == 'field') {
                        ?>
                                <?php 
                        if (get_post_meta(get_the_ID(), $module_desc_fields, true)) {
                            ?>
                                    <?php 
                            echo get_post_meta(get_the_ID(), $module_desc_fields, true);
                            ?>
                                <?php 
                        }
                        ?>
                        		
                        	<?php 
                    } elseif ($module_desc == 'none') {
                        ?>
                        	<?php 
                    } else {
                        ?>
	
                        		<?php 
                        kama_excerpt('maxchar=120');
                        ?>
                    		<?php 
                    }
                    ?>
                        </p>
                        <div class="star"><?php 
                    rehub_get_user_results('small', 'yes');
                    ?>
</div>
                    </div>
                    <div class="rating_col">
                    <?php 
                    if ($rating_circle == '1') {
                        ?>
                        <?php 
                        $rating_score_clean = rehub_get_overall_score();
                        ?>
                        <div class="top-rating-item-circle-view">
	                        <div class="radial-progress" data-rating="<?php 
                        echo $rating_score_clean;
                        ?>
">
	                            <div class="circle">
	                                <div class="mask full">
	                                    <div class="fill"></div>
	                                </div>
	                                <div class="mask half">
	                                    <div class="fill"></div>
	                                    <div class="fill fix"></div>
	                                </div>
	                                
	                            </div>
	                            <div class="inset">
	                                <div class="percentage"><?php 
                        echo $rating_score_clean;
                        ?>
</div>
	                            </div>
	                        </div>
                        </div>
                    <?php 
                    } elseif ($rating_circle == '2') {
                        ?>
 
                        <div class="score square_score"> <span class="it_score"><?php 
                        echo rehub_get_overall_score();
                        ?>
</span></div>       
                    <?php 
                    } else {
                        ?>
                        <div class="score"> <span class="it_score"><?php 
                        echo rehub_get_overall_score();
                        ?>
</span></div>    
                    <?php 
                    }
                    ?>
                    </div>
                    <div class="buttons_col">
                    	<?php 
                    rehub_create_btn('');
                    ?>
                        <a href="<?php 
                    the_permalink();
                    ?>
" class="read_full"><?php 
                    if (rehub_option('rehub_review_text') != '') {
                        echo rehub_option('rehub_review_text');
                    } else {
                        _e('Read full review', 'rehub_framework');
                    }
                    ?>
</a>
                    </div>
                    </div>
                <?php 
                }
                ?>
                </div>
                <?php 
                wp_reset_query();
                ?>
                <?php 
            } else {
                _e('No posts for this criteria.', 'rehub_framework');
                ?>
                <?php 
            }
            ?>

    	<?php 
            $output = ob_get_contents();
            ob_end_clean();
            return $output;
        }
    }