最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

nav_menu not displaying custom menu

programmeradmin2浏览0评论

Default menus will appear on all pages with no issues. However, when I configure a custom menu, it is displayed on all pages, other than the home page//main blog page. The menu disappears, the tags remain there, just empty. All pages are using the same files (index.php, header.php, functions.php)

What am I missing?

Code in header.php here:

<nav class="primary-menu"><?php wp_nav_menu( array('theme_location' => 'primary') ); ?></nav>
<nav class="social-menu"><?php wp_nav_menu( array('theme_location' => 'social') ); ?></nav>

Code in functions.php:

function sl_register_nav_menu(){
    register_nav_menus( 
        array(
            'primary' => __( 'Primary Menu', 'textdomain' ),
            'social' => __( 'Social Menu', 'textdomain')
        ) 
    );
}

add_action('after_setup_theme', 'sl_register_nav_menu');

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论