gpt4 book ai didi

wordpress - 列出所有类别,但仅锚定孙子类别(Wordpress)

转载 作者:行者123 更新时间:2023-12-02 13:47:05 27 4
gpt4 key购买 nike

我目前正在使用它来列出所有类别:

<?php 
$args = array (
'menu' => 'secondary-navigation',
'sort_column' => 'menu_order',
'container' => 'false',
'title_li' => 0,
'hide_empty' => 0
);
wp_list_categories($args);
?>

这将简单地列出层次结构中的所有类别以及锚定的每个项目。

我的类别实际上是这样设置的:

Parent
-> Child
-> Grandchild
-> Great Grandchild

我的问题是我只希望曾孙有 anchor 。我不希望 parent 、 child 或孙子有 anchor 。

如有任何建议,我们将不胜感激。

最佳答案

您可以简单地使用纯 CSS 禁用链接,而无需更改任何 php 代码。检查以下代码,它将改变鼠标光标,禁用链接功能,并隐藏下划线样式:

.cat-item a, .cat-item .cat-item .cat-item .cat-item a {
cursor: default;
pointer-events: none;
text-decoration: none;
}
.cat-item .cat-item .cat-item a {
cursor: pointer;
pointer-events: auto;
text-decoration: underline;
/* also add here any special style for grandchildren categories */
}

结果将完全符合您的要求,只有孙类别似乎被锚定。

希望能解答您的问题

关于wordpress - 列出所有类别,但仅锚定孙子类别(Wordpress),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14048753/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com