• Resolved maropincevic

    (@maropincevic)


    Hi,
    How can i have Excerpts instead of Content?
    I use in template:

    $reviews = glsr_get_reviews( $args );
    <?php foreach ( $reviews as $review ) { ?>
    <?php   echo $reviews->content; ?>
    <?php }?>

    So how can I use excerpts instead content?

    The page I need help with: [log in to see the link]

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

    (@geminilabs)

    Try this:

    $reviews = glsr_get_reviews($args);
    foreach ($reviews as $review) {
        $html = $review->build();
        echo $html->content;
    }

    See also the Functions documentation on the Help page.

    Thread Starter maropincevic

    (@maropincevic)

    Hi, Thank you for your answer.

    But this won’t work, I get Show more /# link and my reviews are the same size.
    Can you send me the documentation link?

    Plugin Author Gemini Labs

    (@geminilabs)

    Can you send me the documentation link?

    It’s probably not working because the Site Reviews CSS requires the HTML to be structured in a specific way.

    It’s assumed if you are using the functions that you are using your own CSS to style the reviews.

    Here is a screenshot from one of the examples in the documentation on the Site Reviews “Help & Support” page:

    To expand on this example:

    
    // Build the HTML for each of the review fields
    $reviewsHtml = $reviews->build();
    
    // Add the correct class to the wrapper DIV
    echo sprintf('<div class="%s">', $reviewsHtml->style);
    
    foreach ($reviewsHtml as $reviewHtml) {
    
        // display the rendered HTML of the review content
        echo $reviewHtml->content;
    
        // display the unrendered value of the review content
        echo $reviewHtml->review->content;
    
    }
    echo '</div>';
    

    The documentation for the glsr_get_reviews is sparse, which is why you will probably want to also make use of the glsr_debug helper function to help you figure things out:

    • This reply was modified 2 years, 1 month ago by Gemini Labs.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Enable Excerpts in Template’ is closed to new replies.