Technically speaking, there is no “standard” Post Format. Rather, “standard” is simply the default – as in, no Post Format type is defined.
If no Post Format type is defined, get_post_format()
simply returns null
.
I would suggest re-factoring your code above, and re-naming your icon images using the exact Post Format string. That way, you could do:
<div class="post-format">
<?php $format = get_post_format(); ?>
<?php if( $format ) { ?>
<img src="https://wordpress.stackexchange.com/questions/14791/<?php echo home_url(); ?>/post-icons/<?php echo $format; ?>.png" alt="<?php echo $format; ?>" />
<?php } else { ?>
<img src="<?php echo home_url(); ?>/post-icons/standard.png" alt="Standard" />
<?php } ?>
</div>
Or perhaps:
<div class="post-format">
<?php $format = ( get_post_format() ? get_post_format() : 'standard' ); ?>
<img src="https://wordpress.stackexchange.com/questions/14791/<?php echo home_url(); ?>/post-icons/<?php echo $format; ?>.png" alt="<?php echo $format; ?>" />
</div>
Either one should work.