Wordpress: Something like is_blog_index() when using a static front page?
In WordPress 3 I've set up a static front page (called "Home"). I need to add a condition in my common header that will return true when viewing the main blog page. The built-in function is_page('blog') doesn't work for this, is_front_page() doesn't either and is_home() returns true on Home as expected. I could have sworn WP alread开发者_开发知识库y had a function for determining if we're on the blog index, but I can't find it anywhere. Is there one, or do I need to write a custom function?
the funcation is is_front_page() to use for your static front page, and is_home() to use for your recent posts page. you must be doing something wrong.
Take care about the queries you're running before testing on what page you are, because they can modify the standard one for the instance.
To ensure you'll get the desired page, do a wp_reset_query()
just before the is_home()
, or is_page()
test.
精彩评论