Wordpress check if blog post (ok)

Example 1:

global $wp_query;
if ( isset( $wp_query ) && (bool) $wp_query->is_posts_page ) {
    //static blog page
}

Example 2:

function is_blog () {
  return ( is_archive() || is_author() || is_category() || is_home() || is_single() || is_tag()) && 'post' == get_post_type();
}

Last updated