Hot answers tagged


get_post_format() returns the post format slug for either the current post, when used inside a loop, or a given post, when a WP_Post object or an integer post ID is passed to it as a parameter. So, if you're using the function in a posts loop, then you can use it like this, while ( have_posts() ) { the_post(); if ( 'gallery' === get_post_format() ) { ...

Only top voted, non community-wiki answers of a minimum length are eligible