If you have custom post types then there is a likelihood that you may want to show them on the same page but have different excerpt length for each of theme. Here is a simple snippet to help do this:
Replace “my-custompost-type1” with the slug of your custom post type. Obviously you can also add another if statement and adjust for other custom post types that you may have.