WordPress 风格类别小部件

发布于 2024-09-30 19:25:49 字数 64 浏览 0 评论 0原文

我正在尝试找出如何仅设置类别小部件的样式。所有小部件都使用相同的 div 名称。我可以使用代码来区分类别小部件吗?

I'm trying to find out how to style only the category widget. All widgets are using the same div names. Is there a code I can use to differentiate the category widget?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜血缘 2024-10-07 19:25:49

您的主题应该将小部件包含在某个标签中,并具有该小部件特有的类。请参阅 register_sidebar 的文档,了解如何指定 before_widget 属性来执行此操作:

http://codex.wordpress。 org/Function_Reference/register_sidebar

如果失败,如果小部件没有任何可以定位的唯一选择器,那么您必须创建它们。如果您要编辑内置小部件,我建议将其代码复制到您的functions.php中,而不是就地编辑它,这样升级WordPress就不会删除您的修改。只需使用不同的名称注册小部件即可。

Your theme should enclose widgets in some tag with a class unique to that widget. Look at the documentation for register_sidebar for how to specify the before_widget property to do so:

http://codex.wordpress.org/Function_Reference/register_sidebar

Failing that, if the widget doesn't have any unique selectors you can target, then you'll have to create them. If you're going to edit a built-in widget, I recommend copying its code into your functions.php rather than editing it in place, so that upgrading WordPress doesn't remove your modifications. Just register the widget with a different name.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文