• Resolved shadow772

    (@shadow772)


    I need the highlighting feature and it works, despite the fact the results (pages, posts, cpt) do not have real content in the excerpts or even support them. (activated indiviual snippets and custom fields for snippets options)
    no errors, everything fine.

    WpGridbuilder Support just added

    if ( ‘on’ === $make_excerpts && ! empty( $post->post_excerpt ) )

    for doing the highlights in the results, but with “&& ! empty( $post->post_excerpt )” it doesn’t work, since as said, no real content in excerpt fields.
    WPGB insists to do so since Relevanssi says “only activate if you use exerpts”, but it works without.

    Could you confirm, that the highlighting doesn’t need real excerpt-content in the posts to work, so the WPGB will remove this code-part? It refuses to do so.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Without context it’s hard to comment the code, but if you’ve enabled custom excerpts in Relevanssi, Relevanssi does place the custom excerpt in $post->post_excerpt. It should not be empty when Relevanssi has generated excerpt, no matter what the source material for the excerpt is.

    Thread Starter shadow772

    (@shadow772)

    Maybe this makes it a little bit clearer:

    in the search results, I have a page.
    the excerpt generated in the results display has some text, including the highlighted search phrase.
    The site itself has no excerpt filled by us. I don’t even have a checkbox for it in the backend editing-site of this page to display.
    But as mentioned, it works. (same goes for every other post type, no excerpt filled by us or even enabled for cpt)

    WPGB now has following code: https://pastebin.com/w5DJTMaP
    With the part && ! empty( $post->post_excerpt )
    the highlighting doesn’t work, but without it does.

    Support insists this part of code, because relevanssi says, excerpt has to be filled to use this feature, otherwise there are errors.
    But there aren’t any erros, EVEN the excerpts are not filled (by us)

    Plugin Author Mikko Saari

    (@msaari)

    Well, put that way, it certainly doesn’t make any sense. Relevanssi doesn’t require anything to be in $post->post_excerpt, quite the contrary –?Relevanssi ignores what’s in there and overwrites it with the excerpt Relevanssi generates.

    So yeah, that’s wrong and will break Relevanssi excerpts. There’s no need to check if there’s anything in $post->post_excerpt because even if there is, Relevanssi won’t be using it.

    Thread Starter shadow772

    (@shadow772)

    Thank you for making it clear, I will forward this topic to the wpgb-support.

    Thread Starter shadow772

    (@shadow772)

    You won’t believe it. After showing him this thread he answered:

    Hello,

    As mentioned in my previous reply, this chekc is mandatory to prevent errors.
    I close this ticket, because there isn’t any issue.
    Thank you for your understanding.

    Plugin Author Mikko Saari

    (@msaari)

    Is there a filter or an action that happens before this that you could use to add something to $post->post_excerpt? That would be a way to bypass this check.

    Thread Starter shadow772

    (@shadow772)

    The dev used this check because so he is sure, that his code, which strips away wpgb-shortcodes, worked, before doing other stuff.

    Luckily we now found a solution using relevanssi_pre_excerpt_content and
    relevanssi_post_content filters, to do so instead of checking if excerpts are not empty.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Relevanssi highlighting without real excerpt’ is closed to new replies.