0

I'm trying to alter the length of the services excerpt / description used by VC in Wordpress

I've used the function

function custom_excerpt_length( $length ) {
return 100;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

This however only allows an increase of post length from what I know? I'm unsure of the function that Services excerpt uses with VC

The exact class is sc_services_item_description but I'm not sure where it's called from

Tom Hutchison
  • 73
  • 1
  • 1
  • 6

1 Answers1

0

You can try below code to apply a limit of the excerpt for custom post type.

// CHANGE EXCERPT LENGTH FOR DIFFERENT POST TYPES

    function isacustom_excerpt_length($length) {
     global $post;
     if ($post->post_type == 'post')
     return 32;
     else if ($post->post_type == 'services')
     return 100;
     else
     return 80;
    }
    add_filter('excerpt_length', 'isacustom_excerpt_length');

Hope, It might be work for you. Thank you.

Gajjar Chintan
  • 420
  • 2
  • 8