Skip to content

Instantly share code, notes, and snippets.

@Aziz-Rahman
Created February 22, 2015 17:43
Show Gist options
  • Save Aziz-Rahman/79d441dc880fe026bdc7 to your computer and use it in GitHub Desktop.
Save Aziz-Rahman/79d441dc880fe026bdc7 to your computer and use it in GitHub Desktop.
Post format wp
<?php
if ( has_post_format( 'video' ) ) {
echo '<div class="thumbnail"><div class="fluid-width-video-wrapper">';
echo wp_oembed_get( get_field( 'video' ) );
echo '</div></div>';
} else if ( has_post_format( 'status' ) ) {
$featured_image = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); // Get featured image url
echo '<div class="thumbnail socmed-thumbnail" style="background: url('.$featured_image.') center center; background-size: cover;">';
echo wp_oembed_get( esc_url( get_field( 'status' ) ) );
echo '</div>';
} else if ( has_post_format( 'audio' ) ) {
echo '<div class="thumbnail">';
echo wp_oembed_get( get_field( 'audio' ) );
echo '</div>';
//etc
} else {
echo '<div class="thumbnail">';
the_post_thumbnail( 'blog-image' );
echo '</div>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment