0

For example Phoca Gallery one: Phoca Gallery shortcode

This is a workaround I could try to go instead: How to show full article in Smart Search results or perhaps showing only sentences with relevant words. But I'm curious if there's any simple way to just strip the unparsed shortcodes instead.

1 Answer 1

1

This is something that really needs to be fixed inside the content plugins you're using. In this case, it's the Phoca Gallery plugin. It has a forum and an issue tracker where you can report the issue.

In the meantime, you can override components/com_finder/tmpl/search/default_result.php layout and add your customizations there. After this block:

if (!empty($this->result->summary) && !empty($this->result->body)) {
    $full_description = Helper::parse($this->result->summary . $this->result->body);
}

Add this:

$full_description = preg_replace('/{.+}/', '', $full_description);

But beware this will strip any content between curly braces, not just valid shortcodes.

3
  • Thanks. Yeah, the point is to remove just shortcodes. Is there any API/function for that? Or are plugins just handling those entirely on their own?
    – Destroy666
    Commented May 8 at 19:27
  • This is currently done entirely in individual plugins.
    – Sharky
    Commented May 9 at 11:22
  • Ok, I'll mark this as answer in that case, although if anyone ever comes up with something more reliable, I'll switch to that.
    – Destroy666
    Commented May 9 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.