admin管理员组文章数量:1317131
By default if a user has not created say a footer or a top level menu then WordPress, in the case of the footer, will use default content like pages and so on to "create" a menu.
I don't want this to happen. I want to do something like:
if user has not set a menu for footer
display a message telling them they should.
else
display said menu.
end
How would I do this?
By default if a user has not created say a footer or a top level menu then WordPress, in the case of the footer, will use default content like pages and so on to "create" a menu.
I don't want this to happen. I want to do something like:
if user has not set a menu for footer
display a message telling them they should.
else
display said menu.
end
How would I do this?
Share Improve this question asked Jun 4, 2013 at 22:45 TheWebsTheWebs 1,1053 gold badges19 silver badges30 bronze badges1 Answer
Reset to default 1check in footer if their any menu for their location
<?php
if ( has_nav_menu( $location ) ) {
//add your footer menu or do something
}else{
//display a message telling them they should
}
?>
Important Link:
has_menu_nav
本文标签: phpHow to tell if a user has gone in and created a menu
版权声明:本文标题:php - How to tell if a user has gone in and created a menu 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742020668a2414574.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论