在我正在构建的主题中,我有这样一个结构来检测某个页面的类型。但是,如果我访问mydomain。com/类别/或mydomain。com/tag/,我只得到have\\u posts()的else语句中的“nothing found”消息。有没有办法检测这些链接何时被访问并显示最终else语句中没有的内容?
if(is_category()):
echo \'<h1>title here</h1>\';
elseif(is_tag()):
echo \'<h1>title here</h1>\';
elseif(is_author():
echo \'<h1>title here</h1>\';
elseif(is_archive()):
echo \'<h1>title here</h1>\';
endif;
if(have_posts()):
//the loop
else:
echo \'<h1>Nothing Found</h1>\';
endif;