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();
}
PreviousAdding Custom Post Types to the Main Blog Page (ok)NextConditional to check if an instance of a block is the first on page/post (ok)
Last updated
Was this helpful?