编写IF语句但没有ENDIF的正确方法?

Am I doing this right? It works but wanted to ask if what I have done is bad practice?

Originally if the page is home then will get include a php file otherwise if it is a generic page will call in the featured image in WordPress.

<?php 
if ( is_page('home')) { 
    get_template_part( 'hero' ); 
} ?>
 <?php echo get_the_post_thumbnail($post->ID); ?>

Your code is wrong in my opinion based on what you requested in question. You only check if is home and if it is get template part 'hero'. After that no matter what page is you call get_the_post_thumbnail.

otherwise if it is a generic page will call in the featured image in WordPress

otherwise means else and your code should look like this:

<?php 
    if ( is_page('home')) { 
        get_template_part( 'hero' ); 
    } else {
        echo get_the_post_thumbnail($post->ID);
    }
?>

Do not forget to be in loop to call $post->ID You can aford endif by using <?php if(){ ... } ?> or <?php if(){ ?> ... <?php } ?>

no, it's okay. If the condition is not fulfilled, nothing will happen.