Both I guess. For example- a video post will have a video icon next to the title and will concentrate most on showcasing the video.
For CSS differentiation, ensure that you use the post_class()
template tag, which will enable you to take advantage of the post-format specific CSS classes that WordPress generates for the post container – such as .format-video
or .format-gallery
.
For even more CSS control, ensure that you use the body_class()
template tag, which will enable you to take advantage of the post-format specific CSS classes that WordPress generates for the HTML body tag – such as .single-format-video
or .single-format-gallery
. for single blog post pages, and .term-post-format-video
and .term-post-format-gallery
for taxonomy archive index pages.
I know how to do it using if/else in my loop but is there most manageable way to do it? like keep each different style in a defferent file (post-video.php,post-standard.php).
Now the real fun begins! One of the tricks of the trade is the quite handy get_post_format()
template tag, which you can use like so:
get_template_part( 'post', get_post_format() );
Which will get post-video.php
or post-gallery.php
, etc. Using this method will completely eliminate the need to use a bunch of if/else
statements, or a switch
, etc.
Note that get_post_format()
returns FALSE
if no post format is set (i.e. for standard post format), so you can either have a post.php
as a fallback, or you can use an approach such as this one:
$post_format = ( get_post_format() ? get_post_format() : 'standard' );
…which will then cause this:
get_template_part( 'post', $post_format );
…to get post-standard.php
for “standard” post formats.