I have loop and template for post
if ( have_posts() ) : ?>
<div class="container">
<div class="row">
<?php while ( have_posts() ) : the_post();?>
<?php get_template_part( 'template-parts/post', get_post_format() );?>
<?php endwhile; ?>
</div>
</div>
<?php else :?>
<?php get_template_part( 'template-parts/content', 'none' );?>
<?php endif; ?>
and I want to use post format and add special html code for eash post format, so i add to my post template (post.php in template-parts):
<?php if ( get_post_format() == 'link' ) : ?>
//code here
<?php endif;?>
but it doesnt work.
So is it possible to use get_post_format() function in post template file? Or how to check current post format inside post template file?