• Resolved Mattman0444

    (@mattman0444)


    Love the plugin so far, its FAR better than anything i’ve used in the past.

    My only qualm so far is that i have some <style> tags at the top of my pages that control a banner image on a per-page basis and the first line of the blurb under the search results has the stripped style code included.

    The raw html on the page would be:
    <style>some styles here</style>
    <p>Page content or whatever</p>

    The first line of the blurb is:
    some styles here Page content or whatever

    It strips the tags, but not whats in between them.

    The work around I’ve been doing is to move the styles to the bottom of the page, but was wondering if there is an easier way to archive this.

    https://www.ads-software.com/plugins/better-search/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ajay

    (@ajay)

    The best option is to actually write your own excerpt for the posts while you’re writing them which ensures that the plugin displays the excerpt and not the content.

    Another option is to create your own function that filters get_bsearch_excerpt. Something along the lines of the below (untested).

    function filter_bsearch_excerpt($out) {
      $output = str_replace("some styles here","",$out);
      $output = str_replace("Page content or whateve","",$out);
    return $output
    }
    add_filter('get_bsearch_excerpt','filter_bsearch_excerpt');
    Thread Starter Mattman0444

    (@mattman0444)

    Perfect – and thank you for the quick reply.

    I installed a plugin that would allow me to edit excerpts on pages (not just posts) and everything works perfect.

    Plugin Author Ajay

    (@ajay)

    That’s great to know! Which plugin would this be?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Style tags showing up in search results blurb’ is closed to new replies.