Thomas Hermansen
Thomas Hermansen

Reputation: 55

WordPress custom menu links

I am creating a custom theme WordPress but I am having some issues.. This is how I call my custom menu.

function wislow_theme_setup() {
    add_theme_support('menus');

    register_nav_menu('primary', 'Primary Header Navigation');
    register_nav_menu('secondary', 'Footer Navigation');
}
add_action('init', 'wislow_theme_setup');

Here is how I implement in my header file.

<body <?php body_class(array()); ?>>
    <?php wp_nav_menu(['theme_location' => 'primary']); ?>

The problem though is when I try to use one of the links I am being directed to an empty page, and the pages do have content within.

Upvotes: 0

Views: 69

Answers (2)

Chintan Hingrajiya
Chintan Hingrajiya

Reputation: 21

wp_nav_menu function use like this : wp_nav_menu(array('theme_location' => 'primary'));

Upvotes: 1

Chintan Hingrajiya
Chintan Hingrajiya

Reputation: 21

please make sure menu location selection

Dashboard > Menus > Manage Locations

and select primary menu which you created menu.

Upvotes: 1

Related Questions