我想在点击“家”图标时这样做:
我是初学者,不知道如何检测一个wordpress mu子博客的主页上下文,有什么想法吗,谢谢?
发布于 2016-09-07 20:40:17
可以使用以下条件进行测试
//if you aren't on the main site, and aren't on the homepage
if (!is_main_site() && (!is_front_page() && !is_home())) {
print "<a href='sub-blog-homepage'>home</a>";
}
//if you aren't on the main site, and aren on the homepage
if (!is_main_site() && (is_front_page() && is_home())) {
print "<a href='main-site-homepage'>home</a>";
}另外,根据您的子博客主页的配置方式,您可以使用is_front_page()、is_home()。
https://wordpress.stackexchange.com/questions/238529
复制相似问题