GG资源网

在wordpress模板中添加自定义导航菜单

问题描述:

I\'m trying to add a custom menu over my WordPress site inside a template page. I\'ve successfully registered new menu with this code

Now I\'ve added this menu inside page.php and successfully getting menu items over my wordpress pages

The question is I\'m seeing the menu items vertical like this http://prntscr.com/dt6300 . How can I style my custom menu? If someone could give a hint!

网友观点:

it depends on what kind of menu you want to make. You can inspect the code on the browser to see the classes of the generated HTML and create the relative CSS for each element.
you can pass the container argument to wp_nav_menu:

https://developer.wordpress.org/reference/functions/wp_nav_menu/

\'container\'

(string) Whether to wrap the ul, and what to wrap it with. Default \'div\'.

and the following arguments to give id and class to the elements:

\'menu_class\'

(string) CSS class to use for the ul element which forms the menu. Default \'menu\'.

\'menu_id\' (string)

The ID that is applied to the ul element which forms the menu. Default is the menu slug, incremented.

\'container_class\' (string)

Class that is applied to the container. Default \'menu-{menu slug}-container\'.

\'container_id\' (string)

The ID that is applied to the container.

You can also see here:
https://codex.wordpress.org/Creating_Horizontal_Menus

由于网站搬家,部分链接失效,如无法下载,请联系站长!谢谢支持!
1. 带 [亲测] 说明源码已经被站长亲测过!
2. 下载后的源码请在24小时内删除,仅供学习用途!
3. 分享目的仅供大家学习和交流,请不要用于商业用途!
4. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
5. 本站所有资源来源于站长上传和网络,如有侵权请邮件联系站长!
6. 没带 [亲测] 代表站长时间紧促,站长会保持每天更新 [亲测] 源码 !
7. 盗版ripro用户购买ripro美化无担保,若设置不成功/不生效我们不支持退款!
8. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
9. 如果你也有好源码或者教程,可以到审核区发布,分享有金币奖励和额外收入!
10.如果您购买了某个产品,而我们还没来得及更新,请联系站长或留言催更,谢谢理解 !
GG资源网 » 在wordpress模板中添加自定义导航菜单

发表回复

CAPTCHAis initialing...