默认情况下如何在WordPress中将菜单添加到菜单位置

我正在尝试为我的新WordPress主题添加菜单, 我想发生的是, 默认情况下将菜单添加到注册菜单位置, 而不必转到仪表板并选择要显示的菜单那里。

我看了几本教程, 他们都手动添加了菜单

这是已注册位置的functions.php文件。

register_nav_menus( array(
        'main-menu' => esc_html__( 'Primary Menu', 'tester' ), 'footer-social-menu' => esc_html__( 'Social Menu', 'tester' )
));

我称之为

<?php wp_nav_menu(array('theme_location' => 'footer-social-menu')); ?>

但是WordPress默认情况下仍未显示菜单

自定义▸菜单视图▸所有位置

社交菜单区仍然显示

---Select---

能做到吗?

(注意:菜单在那里, 我只需要手动选择它, 即菜单区域和菜单已成功注册并可以使用)


#1


我有这个工作

<?php
    wp_nav_menu(array(
    'theme_location' => 'footer-social-menu', 'menu' => 'Social Menu', 'fallback_cb' => false
    )); 
?>

通过添加

'menu' => 'Social Menu', 

如调用创建的菜单时所示

来源:

https://www.srcmini02.com/63389.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37644.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?