Search
 
SCRIPT & CODE EXAMPLE
 

PHP

max title limit woocommerce product

add_filter( 'the_title', 'shorten_woo_product_title', 10, 2 );
function shorten_woo_product_title( $title, $id ) {
    if ( ! is_singular( array( 'product' ) ) && get_post_type( $id ) === 'product' && strlen( $title ) > 20 ) {
        return substr( $title, 0, 20) . '…'; // change last number to the number of characters you want
    } else {
        return $title;
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: Undefined index: file in upload.php 
Php :: laravel get data from request 
Php :: laravel parent child relationship in same table 
Php :: copy folder contect to anthor folder php 
Php :: how to merge 2 laravel eloquent records 
Php :: autoload file in laravel 
Php :: Access-Control-Allow-Origin php laravel 
Php :: custom autoload without composer 
Php :: laravel get route parameters in blade value 
Php :: last_insert_id() php 
Php :: php invoke 
Php :: woocommerce_order_status_changed add action 
Php :: Remove revisions from Wordpress pages 
Php :: add-basic-controller-imports 
Php :: random integer in php 
Php :: como destruir uma variavel de sessão 
Php :: Round the number in php 
Php :: laravel tinker hash password 
Php :: codeigniter 3 where not in 
Php :: author page url from the current post 
Php :: login form using php pdo 
Php :: laravel blade @auth 
Php :: laravel intersect 
Php :: autoloader php 
Php :: Use DateTime() and DateInterval() Objects for PHP 5.3 and Above and Calculate the Difference Between Two Dates Using PHP 
Php :: php http method 
Php :: php strpos 
Php :: ci4 throw new exception 
Php :: laravel 6 make http request 
Php :: move img to public folder in laravel 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =