2
votes

I am trying to create a theme for wordpress and created a custom menu and sidebar for the theme. However, for the custom menu, it appears inside the admin page as the picture shown. Can I know why this is happening and how to make it only display on the page itself? Thanks inn advance. enter image description here

My code for the custom sidebar and menu:

function custom_menu() {
$args = array(
    'theme_location'  => '',
    'menu'            => '',
    'container'       => 'div',
    'container_class' => '',
    'container_id'    => '',
    'menu_class'      => 'menu',
    'menu_id'         => '',
    'echo'            => true,
    'fallback_cb'     => 'wp_page_menu',
    'before'          => '',
    'after'           => '',
    'link_before'     => '',
    'link_after'      => '',
    'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
    'depth'           => 0,
    'walker'          => ''
    );

wp_nav_menu($args);
register_nav_menu( 'primary', 'primary_menu');}


function custom_sidebar()  {
$args = array(
    'id'            => 'sidebar_nav',
    'name'          => __( 'Sidebar', 'text_domain' ),
    'description'   => __( 'Sidebar Description', 'text_domain' ),
    'class'         => '',
    'before_title'  => '<h2 class="widgettitle">',
    'after_title'   => '</h2>',
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget'  => '</li>',
);

register_sidebar( $args );}

add_action( 'widgets_init', 'custom_sidebar' );?>
1

1 Answers

0
votes

wp_nav_menu() prints the nav menu, and belongs in a theme template file like e.g. header.php. Remove it from the registering function.