WordPress自定义菜单没有出现在屏幕上

时间:2018-10-16 14:01:33

标签: php wordpress menu

自定义菜单正在运行,但是wp-admin在外观中未显示选项“菜单”。我尝试了很多选择,但到目前为止都没有奏效。自定义菜单的链接起作用。

function.php

function meus_menus() {   register_nav_menus(
 array(
   'primary' => __( 'Primary Menu' ),
   'categorias' => __( 'Categorias' )
 )   ); } 
 add_action( 'after_setup_theme', 'meus_menus' );


header.php

            <?php
                wp_nav_menu(array(
                ‘menu’ => ‘primary’,
                ‘theme_location’ => ‘meus_menus’,
                ‘container’ => ‘div’,
                ‘container_class’ => ‘classe_do_container’,
                ‘container_id’ => ‘id_do_container’,
                ‘menu_class’ => ‘classe_do_menu’,
                ‘echo’ => true,
                ‘menu_id’ => ‘id_do_menu’,
                ‘before’ => ”,
                ‘after’ => ”,
                ‘link_before’ => ”,
                ‘link_after’ => ”,
                ‘depth’ => 0,
                ‘walker’ => ”,
                ));
            ?>

1 个答案:

答案 0 :(得分:0)

您正在挂错事件。尝试更改您的add_action(),以使其在 init 事件上触发。

add_action( 'init', 'meus_menus' );