• Resolved Jedediah White

    (@toasterdroid)


    Hello; I’d like to show two random reviews on the home-page. I managed to narrow them to two and even use the ‘offset’ setting, but I need them to be more random. Is there a way to do this? Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    Thread Starter Jedediah White

    (@toasterdroid)

    Thanks! If anyone else is interested in doing this. I added the following in my functions.php file:

    add_shortcode('site_review_random', function ($atts) {
        $atts['orderby'] = 'random';
        $atts['per_page'] = 1;
        if ($reviews = apply_filters('glsr_get_reviews', null, $atts)) {
            $html = $reviews->build();
            return sprintf('<div class="%s">%s</div>', $html->style, $html);
        }
    });

    Then on my page.php file I added (specifically to the home-page):
    <?php echo do_shortcode( '[site_review_random display="2" rating="5"]' ); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get two random reviews’ is closed to new replies.