Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

WooCommerce - Shorten product titles

lorro Dec 12th, 2016 60 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. <?php
  2.   // shorten product title
  3.   // code goes in functions.php for your child theme
  4.   add_filter('the_title', 'modify_title', 10);
  5.   function modify_title( $title ) {
  6.     if ( is_woocommerce() || is_product_category() ) {
  7.       if ( strlen( $title ) > 10 ) {      
  8.         $title = substr($title, 0, 10).'...';
  9.       }
  10.     }
  11.     return $title;
  12.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top