Created
August 20, 2014 03:46
-
-
Save aisin/ff15d4285b2ebfdb006c to your computer and use it in GitHub Desktop.
WordPress 判断是否首页
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* | |
* 通常使用 is_home() 函数即可判断首页,但是有时候在首页不起作用 | |
* | |
*/ | |
if( is_home() || is_front_page() ) { | |
// 首页执行 | |
// do something... | |
} | |
if( !is_home() && !is_front_page() ) { | |
// 非首页执行 | |
// do something... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment