Custom content using in_category

in_category() accepts an array of categories to check against. So if you can get a list of all child categories for the parent category you want to check you can use that to see if your post is in any of those.

You can do this by using get_categories() and specifying the parent. This will get all categories who are direct children of the given category. If you also specify fields as ids you can just get their IDs, which will work better for in_category():

<?php
$categories = get_categories( array(
    'parent' => 123,
    'fields' => 'ids',
) );

if ( in_category( $categories ) ) : ?>
    // Content here
<?php endif; ?>

If you only have the slug of the parent category, you’ll need to use get_term_by() to get the ID for use as the parent argument:

<?php
$parent = get_term_by( 'slug', 'category-slug', 'category' );

$categories = get_categories( array(
    'parent' => $parent->term_id,
    'fields' => 'ids',
) );

if ( in_category( $categories ) ) : ?>
    // Content here
<?php endif; ?>