WordPress.org

Ready to get started?Download WordPress

Forums

Custom menus don't show up in admin panel (21 posts)

  1. chrilehner90
    Member
    Posted 9 months ago #

    Hi wordpress-pros,

    I'm writing my own theme and i neet to use custom menus.
    So i activated Appearance > Menus with my functions.php file:

    function register_custom_menu() {
    	if ( function_exists('register_nav_menu') ) {
    	    register_nav_menus(array(
    	        'main' => __( 'Hauptnavigation' ),
    	        'sub' => __( 'Seitennavigation' )
    	    ));
    	}
    	unregister_nav_menu( 'primary' );
    }

    And I'm calling that method from my default-filters.php file.

    But when i create a custom menu with some pages it doesn't show up anywhere in Appearance > Menus. So i cannot rename, change or delete it.

    Has anybody experienced the same problem and knows the solution how to get the menus appear?

    P.S.: I don't use any plug-ins.

    Sorry if somebody posted the same issue, but I didn't find it...

    Thanks in advance!

    Christian

  2. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    Is this a child theme? If not, why are you using unregister_nav_menu( 'primary' );?

  3. chrilehner90
    Member
    Posted 9 months ago #

    Because I wanted just to see my own theme locations. But it makes no difference if I unregister primary or not. In both cases the menus don't appear

  4. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    Because I wanted just to see my own theme locations.

    So is this a child theme or not?

  5. chrilehner90
    Member
    Posted 9 months ago #

    Sorry, I forgot to answer this question: No, it's not.

    /*
    Theme Name: my_name
    Theme URI: localhost
    Description: my_description
    Author: Christian Lehner
    Author URI: -
    */
  6. chrilehner90
    Member
    Posted 9 months ago #

    In the following link you can see an image. That's what i see in the backend. The error message indicates that there should be a main-menu...and i think i should see the main-menu next to the "+"-sign, right?

    Screen

  7. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    If this isn't a child theme, then you can drop unregister_nav_menu( 'primary' );?

  8. chrilehner90
    Member
    Posted 9 months ago #

    I already dropped it.

    But unfortunately my problem is still there

  9. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    Have you incorporated wp_nav_menu() where you want your custom menus to show?

  10. chrilehner90
    Member
    Posted 9 months ago #

    My menus are in the header. And they show up correctly in the header.
    But my problem is that i cannot edit the custom menus i made in the backend, because they're not there (or i can't see the link to the menus). I posted a link to the picture of my backend 4 posts above.

    And i think the custom menus must be somewhere in the backend to edit or delete them, right?

  11. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    What aren't there? The Locations?

  12. chrilehner90
    Member
    Posted 9 months ago #

    Let's say i made a custom menu and named it 'main-menu'. Then there should be a new tab with that name next to the "+"-sign in the backend in Appearance > Menus, right?

    That's not there and i don't know why.

    Or am I wrong and the menu should be accessible somewhere else?

  13. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    there should be a new tab with that name next to the "+"-sign in the backend in Appearance > Menus, right?

    No. You have to create that menu yourself. All the theme can do is specify the final locations for these custom menus.

  14. chrilehner90
    Member
    Posted 9 months ago #

    But I created the menu. And I assigned some of my pages to that menu and then saved it. But I'm looking for a possibility to edit or delete that menu

    I'm sorry, but I don't get it right now...

  15. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    Have you assigned that new menu to either the main or sub locations in Appearance -> Menus?

    You can also remove or add new menu items to the new menu on the same page. And completely delete the menu if you want. You might want to take a few minutes out to review custom menu management.

  16. chrilehner90
    Member
    Posted 9 months ago #

    Thanks for that link, but in the first picture there's exactly the problem I'm experiencing. In that screenshot the user defines a menu called 'navmenu' and gets the tab with the text 'navmenu' next to the '+'-sign.
    When I create a new menu i don't get that tab like you can see it in this screenshot. The error message in my screenshot says that there is already a menu called 'main-menu', but the tab isn't there.
    So I have no possibility to make changes to that custom menu.

  17. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    What happens if you switch to the Twenty Twelve theme?

  18. chrilehner90
    Member
    Posted 9 months ago #

    I also thought that the problem is my theme. But I switched to the Twenty Twelve theme and I'm experiencing the same problem.

  19. esmi
    Theme Diva & Forum Moderator
    Posted 9 months ago #

    Have you deactivated all plugins? Or even better, reset the plugins folder by PhpMyAdmin?

  20. ronangelo
    Member
    Posted 9 months ago #

    You created a custom function register_custom_menu() but it's not being called so it wont execute.

    If it were me I would just add the menus like this

    register_nav_menu('main', __( 'Hauptnavigation' ));
    register_nav_menu('sub', __( 'Seitennavigation' ));
  21. chrilehner90
    Member
    Posted 9 months ago #

    IT'S SOLVED!!!

    Thank you very much for your time, esmi!!! :)
    The plug-ins were not the error...but i tried to use phpmyadmin and I got an error message. The error message (or a similar one) is in the following link and it's including the solution:

    Link

    @ronangelo: i called the function register_custom_menu() from the default_filters.php file with the following code:

    add_action('init', 'register_custom_menu');

    But thank you both :)

Reply

You must log in to post.

About this Topic