Formating results output

This topic contains 4 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 8 years ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #8311
    mensa
    mensa
    Participant

    Hi,

    Reference : http://satviks.com
    Search Restaurants : Use keyword “Mexican”

    Help required for
    =============
    title – Is there a way to format the title fields in the display. For eg in the search output (when you use “Mexican”), I need Promotions “10% Off” in red color.

    Is the above two items possible ?

    #8334
    mensa
    mensa
    Participant

    Hi,

    Any update ? Is this possible ?

    #8346
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    It is possible with a custom filter I guess. Try adding this custom function into your active themes funtions.php file:

    add_filter( 'asp_pagepost_results', 'asp_highlight_off_title', 1, 1 );
     
    function asp_highlight_off_title( $pageposts ) {
      // Text to replace with red
      $text = "10% Off";
    
      foreach ($pageposts as $k=>$v) {
        // Replace title with red font
        $pageposts[$k]->title  = str_replace($text, "<span style='color: red;'>".$text."</span>", $pageposts[$k]->title);
      }
     
      return $pageposts;
    }

    This is case sensitive, so make sure the $text variable holds the exact text you want to replace.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #8385
    mensa
    mensa
    Participant

    Hi,

    Great.. Works. Thanks.

    #8390
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Great!

    If you like the plugin, feel free to rate it on your codecanyon downloads page, it’s greatly appreciated.

    I will close this topic now and mark it as resolved. If you have any other issues, feel free to open another one.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.