• Resolved leelnj

    (@leelnj)


    Hello,

    Is their a way to change excerpt length. i have tried the usual way to change global excerpt length by putting the following in my child function file but it doestnt work

    /* Change Excerpt length */

    function custom_excerpt_length( $length ) {
    return 30;
    }
    add_filter( ‘excerpt_length’, ‘custom_excerpt_length’, 999 );

    https://www.ads-software.com/plugins/good-reviews-wp/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Hi leelnj,

    Are you using the [good-reviews] shortcode or using the usual template archives? If you’re using the shortcode, it always outputs reviews at full length by default. You can use the excerpt attribute to output only excerpts with shortcodes:

    [good-reviews excerpt=1]

    The documentation includes details about all of the shortcode attributes.

    Otherwise, if you’re using custom post type archives or single post templates, it should respect the normal usage of the excerpt length value.

    Thread Starter leelnj

    (@leelnj)

    Hi im using the widget in the widget area with options “fade between reviews” and “show excerpts only”. Currently the excerpt length is 55 words. i want to cut the length to 20 words so all my excerpts are the same length. Also one more question. How can we remove the question marks from the testimonials.Thanks in advance

    Hi leelnj,

    I just tested this myself and didn’t have any problems. I suspect there are one of two issues occurring for you:

    1. I noticed that you’re using angled quotes (‘) instead of straight quotes (‘). This may just be something that happened when you copied the code into this post. But if your code is actually using the ‘ instead of ‘ then it will be causing errors.

    2. It may be that your theme or another plugin is overriding your code. You can try deactivating other plugins and switching to a default theme to see if that helps.

    Thread Starter leelnj

    (@leelnj)

    thank you so much

    Hi, I’ve tried this code a zillion times and cannot change the excerpt length. I was using another plugin that was almost identical to this one but had a TON of more features before this, but switched to this one for the Schema feature. On the other plugin you set the excerpt length right inside the widget settings. This one doesn’t let me and the above code doesn’t work at all…help? I’d like to use the plugin, but can’t when the excerpts in the footer widget are longer than some of my entire posts!

    ps. Your plugin looks 1000 times better than the other one I was using, and seems much lighter too…so once we can resolve the excerpt length I’ll be thrilled!

    pps. can we disable the blockquote on the widget? It looks a bit silly on my site: https://www.miamirealestateguy.com/

    and….never mind.

    I figured out that the above code cannot be added to the child theme functions.php, it must be entered only on the main functions.php in order to work. Once I moved it there, it worked instantly.

    Hi joyryde,

    Glad you were able to find a solution to your problem. That’s odd that it didn’t work in the child theme’s functions.php. I would normally expect it to work but it may have had something to do with when the code was processed, if it was being processed in a different hook or something.

    Regarding the use of <blockquote>: if you’re comfortable writing code, you can use the grfwp_print_reviews_output hook to completely override the output of the reviews. But it will take a fair amount of coding.

    It’s probably easier to override the specific review styles with CSS. If you post a link to a review on your site and details on what you want changed, I can probably share a bit of CSS code that will get you started.

    I would have assumed it would work in the child theme as well, but it didn’t for some reason, but works perfectly in the main functions.php file.

    I attempted to overwrite the CSS and couldn’t get it to work. I put the widget in my footer and changed the length to match the other footer columns:

    https://www.miamirealestateguy.com/

    I like the blue blockquote sidebar when used in a blog post, but not when it’s in the widget, it looks weird (this is the theme, not you). I’m guessing there’s a way to use CSS to hide that only for the widget? Currently it has display: none for all of the reviews, and display:block for the one that’s showing on the widget slider.

    <div id="gr-reviews-0" class="gr-reviews gr-reviews-all hentry gr-reviews-cycle" style="display: block; opacity: 0.449819;">

    Hi joyryde,

    Try this CSS code to remove the border and padding on reviews that appear in your footer widgets:

    .footer-widget .gr-review {
        border: none;
        padding: 0;
    }

    YES, thanks Nate! That looks SO much better!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘excerpt length’ is closed to new replies.