• Resolved Harm10

    (@harm10)


    Would it be possible to incorporate the excerpt function in some way for the reviews? I would like to display a nice excerpt and the read more on the first page.

Viewing 15 replies - 1 through 15 (of 18 total)
  • Hi @harm10,

    If you’re using the shortcode, you can use the excerpt attribute to show only an excerpt:

    https://doc.themeofthecrop.com/plugins/good-reviews-wp/user/faq#shortcode

    The widget also has an option for showing only excerpts.

    Thread Starter Harm10

    (@harm10)

    I should have posed my question in better detail.
    When editing a regular post you get the option to input your own excerpt and if all is correct the theme will show that on web pages where such an excerpt is shown (like a search page).
    This option is not available for the review.

    And can you also point out which excerpt length variable is used to create the review excerpt?

    Hi @harm10,

    The Reviews post type doesn’t support excerpts out-of-the-box. However, you can use the <!--more--> tag to define a custom excerpt from the beginning of the post content. You can learn more about the more tag here:

    https://www.wpbeginner.com/beginners-guide/how-to-properly-use-the-more-tag-in-wordpress/

    If you’re committed to getting a unique excerpt, you’ve got a couple options. First, use the add_post_type_support() function to add support for post types to the grfwp-review post type:

    https://developer.www.ads-software.com/reference/functions/add_post_type_support/

    Second, use a plugin that will add excerpt support to the post type for you:

    https://www.ads-software.com/plugins/tags/excerpt/

    Thread Starter Harm10

    (@harm10)

    Thanks for the elaborate answer.

    I think the <!–more–> tag will do the trick for my request. That one had gone a bit to the background for me. I either use the excerpt or a more complicated script to generate my own excerpt based on certain settings in extra fields coming from the ACF plug-in.
    Sometimes things can be more simple than you think!

    Thanks!

    Thread Starter Harm10

    (@harm10)

    Hi again! I changed the status to not resolved…….

    I tried the more tag on my testsite (offline) and it works OK there.
    Now I am using it on the live site and it hasn’t any effect?
    I tried clearing the cache to no avail.

    Is there something that has to be set to make the more tag work in this plug-in?

    Thread Starter Harm10

    (@harm10)

    Forgot to update the status to set it to Not Resolved. Please look into my question.

    Thread Starter Harm10

    (@harm10)

    Just to be on the safe side I tested whether more tag is working properly within a regular post and it does. So why not on the reviews?

    Hi @harm10,

    Are you displaying the reviews using the shortcode or the custom post type that the plugin creates? If you’re using the shorcode, you’ll need to use the excerpt argument to show the excerpts:

    https://doc.themeofthecrop.com/plugins/good-reviews-wp/user/faq#shortcode

    If you’re not using the shortcode to display the reviews, it could be lots of things. I’d recommend switching to a default theme like TwentySeventeen and deactivating all other plugins. If the excerpt is displayed on the archive page, you can start reactivating them one-by-one until you find the culprit.

    Thread Starter Harm10

    (@harm10)

    I use the code like this
    <code>[good-reviews category='mycat' excerpt=1 ]</code>

    This is exactly the same as on the offline version of the same site (there it works nicely). I already compared the files and found no difference.

    I can imagine your advice but this is a live site! So it is not convenient to switch to another theme and turn of all plug-ins…………..

    I have to think about this…………

    Thread Starter Harm10

    (@harm10)

    I experimented somewhat further to find out that it does work.
    If I place the more tag somewhere in the early beginning of the review it works and if I place it somewhat further in the text it doesn’t work.
    Is there some maximum length in which I have to place this more tag?

    Hi @harm10,

    Hmm, I’ve never heard of any length limit for more tags, so I’m not sure what’s going on there.

    For future reference, you don’t need to use the <code></code> tags when inserting a shortcode. It’s no big deal if it’s in there, but you don’t need to add it it. Doing so might interfere with how the reviews are output, depending on if your theme has styled <code> tags.

    Thread Starter Harm10

    (@harm10)

    If you look at Codex the excerpt you can read that the default is 55 words:
    An auto-generated excerpt will also have all shortcodes and tags removed. It is trimmed down to a word-boundary and the default length is 55 words. For languages in which words are (or can be) described with single characters (ie. East-Asian languages) the word-boundary is actually the character.
    And also:
    The <!--more--> quicktag requires templates to use the_content() whereas using excerpts requires, and allows, template writers to explicitly choose whether to display full posts (using the_content()) or excerpts (using the_excerpt()).

    So does this mean that when I am using the <!–more–> quicktag I should refrain from coding excerpt=1?

    My understanding is that you should still be using excerpt=1. The shortcode uses this to determine whether or not to display an excerpt in the reviews that it prints, which is separate from the the_excerpt/the_content that is being determined for whatever page or post you’ve put the shortcode on.

    Thread Starter Harm10

    (@harm10)

    OK. I did a thorough test now………. First I tested the description of the more tag and excerpt in a regular post.
    I created a post that contains 70 words. Displayed it through the archive (uses excerpt function) and it breaks off after 55 words. I put in a more tag after 20 words and redisplayed that on the archive to see that the break off is after 20 words. Then I put the more tag after 60 words and redisplayed the archive to see that the break off is after 55 again.
    Conclusion the more tag only works in the excerpt function when it is within the set boundaries (I know you can change those boundaries).
    When I use the same approach on a review I get exactly the same behaviour. So so far so good.

    When I change the review to display to NOT use excerpt=1 the review breaks off after 60 words in the list display.
    This is in line with the description given in WP documentation for the_content function. It explicitly states that the more tag will only be used on non single displays.

    So that being said I would ask you to think about an extra option (or maybe a different value for excerpt=) so the plug-in user can specify that more tags are used and so the_content function should be used in stead of the_excerpt.

    I hope I have made my reasoning clear?

    Hi @harm10,

    You can actually customize the excerpt length however you’d like. Typically you do this with a small code snippet, but this plugin looks like it can do that and it’s built by a reputable company:

    https://en-gb.www.ads-software.com/plugins/advanced-excerpt/

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Excerpt function in review?’ is closed to new replies.