Title: Search results customization
Last modified: March 3, 2022

---

# Search results customization

 *  Resolved [discsox](https://wordpress.org/support/users/discsox/)
 * (@discsox)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/search-results-customization/)
 * I was looking for a way to show/hide content depending on whether a search has
   been performed or not. Specifically unhide cell content in search results, hide
   cell content when no search has been made.
    I assume that e.g. adding an appropriate
   class to table cells would have to be made in JavaScript on the fly. Is there
   any extension already available that allows detection when a search has been 
   performed? Do you have any insights whether it is possible to show content only
   in search results?
 * Any help is greatly appreciated.
 * Kind regards,
    Marcello

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

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/search-results-customization/#post-15427778)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * This sounds as if the approach from [https://wordpress.org/support/topic/i-want-the-table-to-be-invisible-until-filter-is-applied/#post-4272342](https://wordpress.org/support/topic/i-want-the-table-to-be-invisible-until-filter-is-applied/#post-4272342)
   might be worth a try.
 * Regards,
    Tobias
 *  Thread Starter [discsox](https://wordpress.org/support/users/discsox/)
 * (@discsox)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/search-results-customization/#post-15429575)
 * Hi Tobias,
    Thank you VERY much for your reply!
 * I was able to get this to work in the following way.
    - add a helper class to the content I want to show when a search has been performed
    - `<span class="helperTxt">content to be shown after search has been performed
      </span>`
    -  In the tablepress-datatables-inverted-filter.php I removed the filtering 
      and just toggled the helper class instead of the find (original code is commented
      out)
    -     ```
          	$commands = <<<JS
          //$.fn.dataTableExt.afnFiltering.push(
          //    function( settings, data, dataIndex ) {
          //		return '' !== settings.oPreviousSearch.sSearch;
      
          //    }
          //);
          {$commands}
          $( '.dataTables_filter' ).find( 'input' ).on( 'keyup', function() {
          	$( '.helperTxt' ).toggle( '' !== $( this ).val() );
          //	$( '.dataTables_wrapper' ).find( '.tablepress' ).toggle( '' !== $( this ).val() );
          } ).keyup();
          JS;
          ```
      
    - Hope this helps someone else and thanks again!
    - Marcello
 *  -  This reply was modified 4 years, 2 months ago by [discsox](https://wordpress.org/support/users/discsox/).
    -  This reply was modified 4 years, 2 months ago by [discsox](https://wordpress.org/support/users/discsox/).
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/search-results-customization/#post-15429674)
 * Hi,
 * nice idea! Thanks for sharing this!
 * Best wishes,
    Tobias   P.S.: In case you haven’t, please rate TablePress [here](https://wordpress.org/support/plugin/tablepress/reviews/#new-post)
   in the plugin directory. Thanks!
 *  Thread Starter [discsox](https://wordpress.org/support/users/discsox/)
 * (@discsox)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/search-results-customization/#post-15429710)
 * Just rated the plugin 🙂
    Cheers, Marcel
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/search-results-customization/#post-15429716)
 * Hi,
 * thanks, I really appreciate it! 🙂
 * Best wishes,
    Tobias

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

The topic ‘Search results customization’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [4 years, 2 months ago](https://wordpress.org/support/topic/search-results-customization/#post-15429716)
 * Status: resolved