Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hai Nastia,

    Awesome

    Thankyou verymuch!

    nice, thankyou

    hi, thanks for the reply,

    the above code works, but the number shown is the sum of all the review instead of each post,

    I changed a little bit above code and managed ie like this :

    function shortcode_reviews_count($atts) {
    
    		global $post;
    
    		extract(shortcode_atts(
    			array(
    				'category' => 'none',
    				'num'	=> '3',
    				'id' => ''
    			)
    		, $atts));
    
    		if ($id != '') {
    			$id = intval($id);
    			$passedPost = get_post($id);
    		}
    
    		if (!isset($passedPost)) {
    			$passedPost = $post;
    		}
    		
    		$reviews = $this->db->get_reviews($category, $num, $passedPost);
    		if(!empty($reviews)) {
    			ob_start();
    			?>
    			<span class="rr-reviews-count">
        	    <?php echo count($reviews); ?>
    	        </span>
    			<?php
    
    			return ob_get_clean();
    		} else {
    			return;
    		}
    		
    	}

    similar in function RICH_REVIEWS_SHOW :),
    and then I can add a filter in the shortcode
    [RICH_REVIEWS_COUNT category="post" id="POST ID"]

    but I do not know what is the best way, maybe you can fix it and make updates to the plugin later 🙂

    Thankyou.

Viewing 3 replies - 1 through 3 (of 3 total)