想要在 WordPress 中使用类别作为页面
我的主导航中有几个页面(主页、关于我……)。现在我想去掉侧边栏,并且主导航中有足够的空间。我是否有机会让我的类别显示在那里,最好将子类别显示为子类别(这在我的下拉菜单中效果很好)?
赞赏!
I have a couple of pages (home, about me, ...) in my main navigation. Now I'd like to get rid of my sidebar and I have plenty of space in my main navigation. Is there any chance I could get my categories to display in there, preferably with the subcategories displaying as childs (which will work well in the dropdown menu I have)?
Appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将列出您的类别。然而,它会垂直列出它们,因此您需要在样式表中使用 css 来创建一个类来水平列出它们。
至于去掉侧边栏。如果您转到index.php和single.php,您将设置类似
或
通过删除此页面,页面将不再获取您的侧边栏。我个人不建议删除 sidebar.php 文件(如果有的话)或出于格式原因删除这一行代码。最好将其注释掉,这样如果您决定再次需要侧边栏,就可以将其添加回来。
<?php wp_list_cats(); ?>
will list your categories. It will however list them vertically so you'll need to use css in your style sheet to create a class to list the horizontally.As for removing the side bar. If you go to your index.php and your single.php you will set something like
<?php sidebar(); ?>
or<?php get_sidebar(); ?>
by removing this the page will no longer fetch your side bar. I would personally not advise deleting the sidebar.php file(if you have one) or deleting this line of code for formatting reasons. It is probably best to comment it out that way you can add it back if you ever decide you want a sidebar again.