I am writing a wordpress plugin and only work it take effect when it is a Page, but not Blog
e.g.
public function init() {
if (is_page())
// do something..
}
It does not work as is_page is only available after wp_query is run [1]
So what are the suggested way to check if current page type is Page or Blog?
[1] http://core.trac.wordpress.org/browser/tags/3.4.2/wp-includes/query.php#L0
you can use is_page() outside of wp_query if you have either of this 3 values:- page ID,page Title or slug.
If you want to check this when the page is loading you could get the id or slug for the permalink and test it using is_page.