5ucms论坛
标题:
wordpress简易面包屑导航
[打印本页]
作者:
admin
时间:
2021-6-3 16:06
标题:
wordpress简易面包屑导航
//面包屑导航 只显示名称的 用foreach把栏目名称提取出来 这个代码放主题的function.php里
function the_breadcrumb() {
if (!is_home()) {
if (is_category() || is_single()) {
foreach((get_the_category()) as $category) {
echo $category->cat_name.' > ';
}
if (is_single()) {
the_title();
}
}
}
}
复制代码
single.php模板里调用 <?php the_breadcrumb(); ?>
其他方法见:
http://bbs.5ucms.com/thread-869-1-1.html
欢迎光临 5ucms论坛 (http://bbs.5ucms.com/)
Powered by Discuz! X3.2