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 badges
Add a comment  | 

1 Answer 1

Reset to default 1

check 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