Support » Plugin: Smart WooCommerce Search » Short description instead of long description?

  • Resolved fabiopwl37


    Is there a way or something I can put in functions.php to display the sort description instead of the long description on the search results page?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author YummyWP



    Sorry for late answer.
    It depends on your theme.
    However you can add a filter
    add_filter('the_content', 'my_function', 9999, 1);
    add_filter('get_the_excerpt', 'my_function', 9999, 1);
    and a function that do smth like that – left 20 symbols

    function my_function($text) {
       if ( is_search() ) {
          $text = mb_substr($text, 0, 20);
       return $text;

    Hey thanks!

    Your answer pointed me toward the right direction. Here is the working code I am using now to insert the short description in place of the long description in the search results for anyone who comes across this needing the answer.

    function insert_short_desc_in_search($text){
    		$text = the_excerpt();
    	return $text;
    add_filter('the_content', 'insert_short_desc_in_search', 9999, 1);
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Short description instead of long description?’ is closed to new replies.