Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // filter the product title
- add_filter( 'the_title', 'wtl_shorten_my_product_title', 10, 2 );
- // limit product title on shop and category page
- function wtl_shorten_my_product_title( $title, $id ) {
- $option = get_option('wtl_opt');
- if(is_plugin_active('woocommerce/woocommerce.php')){
- if ( is_product_category() || is_shop() && get_post_type( $id ) === 'product' ) {
- return substr( $title, 0, $option['wtl_count'] );
- } else {
- return $title;
- }
- }else {
- return $title;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement