简体   繁体   English

Wordpress更改子类别类

[英]Wordpress change sub-category class

I'm having trouble with my WordPress site. 我的WordPress网站遇到了问题。

I have a page displaying my categories and sub-categories. 我有一个显示我的类别和子类别的页面。 They are displayed in a <ul> . 它们显示在<ul>

Now I want to give the sub-categories a class to style them differently. 现在我想给子类别一个类来对它们进行不同的样式设置。

Is this possible with a walker maybe? 这可能是步行者的可能吗?

I can't change the template because it's is loaded in via a plugin (Events manager) 我无法更改模板,因为它是通过插件加载的(事件管理器)

EDIT: the HTML that is generated: 编辑:生成的HTML:

<ul>
<li>Category</li>
<li>sub-Category</li>
<li>sub-Category</li>
<li>Category</li>
<li>sub-Category</li>
<li>sub-Category</li>
</ul>

I can't change the template because it's is loaded in via a plugin (Events manager) 我无法更改模板,因为它是通过插件加载的(事件管理器)

It depends on the plugin. 这取决于插件。 You should look at the documentation for your plugin. 您应该查看插件的文档。 Some plugins will load a default template but allow you to override it with one of your own in your theme. 某些插件会加载默认模板,但允许您使用主题中的一个插件覆盖它。 The plugin may provide a filter that allows you to customize the output, but this seems like a very specific customization you're not likely to find. 该插件可能会提供一个允许您自定义输出的过滤器,但这似乎是您不太可能找到的非常具体的自定义。

Did you know you can target child <ul> elements in CSS without a class? 你知道你可以在没有类的情况下在CSS中定位子<ul>元素吗? For instance, the following would target only <ul> elements that are nested under a <ul> element: 例如,下面将仅靶向<ul>它们嵌套一个下元件<ul>元素:

ul ul {
    background-color: red;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM