How to limit K2 search result text?

Category: | Tag:

By default, K2 search result show full content. So, instead of full content if you want to limit the text with Read More button, follow below few steps.

  1. Open generic.php file (components\com_k2\templates)
  2. Go to Line 86
  3. Change below code
    <?php echo $item->introtext; ?>
    
  4. To this
    <?php echo K2HelperUtilities::wordLimit($item->introtext, 120); ?>
    
  5. That 120 is number of words you desire to have.

NOTE: Remember to use overrides

Copyright © 2024 Siam Naulak.
magnifiercrossmenu