[英]How to make dynamic menu with categories
I have a website and I want to add automatically categories to my menu. 我有一个网站,我想自动在菜单中添加类别。 I mean when I create new category it should appear in my menu.
我的意思是,当我创建新类别时,它应该出现在菜单中。 How I can make it?
我该怎么做?
<?php wp_nav_menu( array( 'theme_location' => 'header', 'container' => '' ) ); ?>
Home | Categories | Contact
category1
category2
category3
Option 1: Create the categories and publish posts in those categories. 选项1:创建类别并在这些类别中发布帖子。 Then create your menu.
然后创建您的菜单。
From the sidebar nav on the left in wordpress>>appearance>>menus scroll down and add categories to your menu. 从左侧边栏中的wordpress >>外观>>菜单中,向下滚动并向菜单中添加类别。
Secondary and third child menus have been a standard feature in the several last recent releases of WP. 第二和第三子菜单一直是WP的最近几个发行版中的标准功能。
Option 2: If for some reason you don't have this feature on your install/setup, add direct urls and add labels to the menu. 选项2:如果由于某种原因在安装/设置中没有此功能,请添加直接URL并在菜单中添加标签。
Happy publishing. 祝出版愉快。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.