In WordPress some time we need to detect the blog page to add extra functionality. Following WordPress function would be helpful to find out the current page is blog page or not.
/** * WordPress' missing is_blog_page() function. Determines if the currently viewed page is * one of the blog pages, including the blog home page, archive, category/tag, author, or single * post pages. * * @return bool */ function is_blog_page() { global $post; //Post type must be 'post'. $post_type = get_post_type($post); //Check all blog-related conditional tags, as well as the current post type, //to determine if we're viewing a blog page. return ( ( is_home() || is_archive() || is_single() ) && ($post_type == 'post') ) ? true : false ; }
code source :https://gist.github.com/wesbos/1189639