wordpress默认分类菜单没有高亮效果,那么如何对分类菜单当前栏目添加样式,下面web建站小编给大家简单介绍一下具体实现代码!
在header.php
模板中新增以下代码:
<ul> <li<?php if (is_home()) { echo ' class="current"';} ?>><a title="Home" href="/">首页</a></li> <?php $currentcategory = ''; if (is_category() || is_single()) { $catsy = get_the_category(); $myCat = $catsy[0]->cat_ID; $currentcategory = '¤t_category='.$myCat; } wp_list_categories('depth=1&title_li=&show_count=0&hide_empty=0&child_of=0'.$currentcategory); wp_list_pages('depth=1&title_li=&sort_column=menu_order'); ?> </ul>
Ps:当前栏目新增current
样式~
WordPress如何利用Python脚本实现文章定时发布功能
标签: wordpress导航栏, wordpress建站技巧
上面是“wordpress如何对分类菜单当前栏目添加样式”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_3791.html
workflows工作流
一群邪恶的小黄人ComfyUI工作流
一位24岁的金发女海盗ComfyUI工作流
一幅以霓虹灯照亮的城市天际线和未来主义画
大黄蜂空中决战ComfyUI工作流
一只可爱的小鸟在飞翔ComfyUI工作流
荷塘月色ComfyUI工作流
森林里一只邪恶的树妖ComfyUI工作流
一只迷人的黑豹ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!