日期:2020-04-25 阅读:1747
基本函数: https://developer.wordpress.org/themes/basics/conditional-tags/
-----------
https://developer.wordpress.org/themes/basics/template-hierarchy/
首页的规则:
front-page.php – Used for both “your latest posts” or “a static page” as set in the front page displays section of Settings → Reading.
home.php – If WordPress cannot find front-page.php and “your latest posts” is set in the front page displays section, it will look for home.php. Additionally, WordPress will look for this file when the posts page is set in the front page displays section.
page.php – When “front page” is set in the front page displays section.
index.php – When “your latest posts” is set in the front page displays section but home.php does not exist or when front page is set but page.php does not exist.
上面意思。front-page.php是首页。
但是home.php 并不一定是首页。因为它只适用于post之类的首页。如果首页指定为page。则不是这个。只能是front-page
所以 is_home() 和 is_front_page() 的用法也就不一样。