Support » Plugins » [Plugin: Yet Another Related Posts Plugin] Show excerpt, not only the first paragraph

  • Resolved llsaboya



    I use YARPP and love it, but one thing makes me crazy. I use the wordpress caption tags for images in my blog, and the related posts shows the caption image code instead of the excerpt. YARPP takes the first paragraph, not the post excerpt.

    I think that would be better YARPP try first to take the excerpt, and them the first paragraph. Is this a easy fix?



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

    I have the same request — I have a lot of caption tags showing up in the related post feature and it looks pretty awful. Isaboya’s request would fix the problem for me!



    Hi all,

    The easiest thing to do would be to turn off the “show excerpt” setting. The WP excerpt is much too long for most user’s blogs.

    I don’t have any plans to add such a setting to YARPP–instead I will document the use of the yarpp_sql command so that people can write their own YARPP-based queries and pull exactly the data they want from each post.


    Even I have a similar problem. I have an image with caption at the start of every post and YARPP’s output looks pretty bad in such a case. Pls do something about it.

    Hmm… perhaps then I’ll take the first x words from the excerpt rather than the first x words from the content… would that work better for everyone?



    I like your idea as long as its an option. Not every post gets an excerpt…

    @domainpubber – Hm? Really? Not every post gets an excerpt??

    Thread Starter llsaboya


    @domainpubber – WordPress uses the first paragraph as excerpt every time when you dont include one. Look:

    Template Tags/the excerpt – Displays the excerpt of the current post with […] at the end, which is not a “read more” link. If you do not provide an explicit excerpt to a post (in the post editor’s optional excerpt field), it will display a teaser which refers to the first 55 words of the post’s content. Also in the latter case, HTML tags and graphics are stripped from the excerpt’s content. This tag must be within The Loop.

    @mitchoyoshitaka – If you change the sql query to pull out the first paragraph of excerpt instead of content, problem solved. The excerpt funccion strips out the caption tags by default.

    @lsaboya– thanks for finding that reference– I was being too lazy. 🙂

    So this means I can just take the first x words of the excerpt and resolve these issues, yes? Can you think of any situations where that would be a problem?

    Thread Starter llsaboya


    @mitchoyoshitaka – Well, take the excerpt instead the post’s content isn’t a problem. People who use the excerpt, like me, will be happy. Other users don’t even note the diference. The plugins have a cool range of opitions, so everybody can customize the output to theirs needs. I cant see any problem.

    @lsaboya – this change was made in 2.1.4.

    Mitcho: thanks for this change.. right away I saw an improvement in my results, however, I have a question.

    Are you pulling this new excerpt directly from the excerpt field in the database, or are you accessing the excerpt via WordPress’s excerpt function?

    Because now when a post has an excerpt, that gets displayed, but when it doesn’t have an excerpt AND it has a [caption] tag early in the first paragraph, the [caption] tag appears in my ‘related posts’ portion of my site, and looks bad.

    I believe, and maybe someone can correct me, the the_excerpt(); function sanitizes the content for you, so even if you had a [caption] tag, it shouldn’t appear. If you are pulling the excerpt directly from the database, this function never gets called.

    Thanks so much for the amazing plugin!

    @kingkong954 – your suspicions are correct–the current iteration just uses the except information from the database and runs some formatting filters on it, though, alas, apparently not the shortcode-expanding filter.

    While I’m not sure why the shortcode filter isn’t running there, I’m not bothering trying to figure it out: the next major revision to YARPP (coming in hopefully a month or so) will display related posts in an (underlyingly) very different fashion, actually using the the_excerpt() function, which will take care of these woes for you. ^^ Look forward to it.

    Great, thanks for looking into it, and keep up the awesome work!

    @kingkong954 As promised, I just released a beta which I believe may fix this issue. I’d appreciate it if you could let me know if it does the trick: YARPP 3.0 beta 1. Thanks!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Plugin: Yet Another Related Posts Plugin] Show excerpt, not only the first paragraph’ is closed to new replies.