Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have my html code for menu as follows:

<div class="menu">
      <ul>
        <li><a href="index.php" >Home</a></li>
        <li><a href="aboutus.php" >About Us</a></li>
        <li><a href="services.php" >Services</a></li>
        <li><a href="success.php" >Success Stories</a></li>
        <li><a href="testimonials.php" >Testimonials</a></li>
        <li><a href="contactus.php" >Contact Us</a></li>
      </ul>

I have registered sidebar in functions.php as follows

<?php
$args = array(
    'name'          => __( 'Main Navigation', 'theme_text_domain' ),
    'id'            => 'sidebar-navigation',
    'description'   => 'Main Navigation Container',
        'class'         => '',
    'before_widget' => '<div>',
    'after_widget'  => '</div>',
    'before_title'  => '<h2 class="widgettitle">',
    'after_title'   => '</h2>' );
    register_sidebar( $args );

?>

After that i called the dynamic sidebar in header.php file as

<?php dynamic_sidebar('sidebar-navigation'); ?>

But i could not see the menus appearing.

share|improve this question
add comment

1 Answer

You should hook it like this :

function customwidget_init()
{
$args = array(
    'name'          => __( 'Main Navigation', 'theme_text_domain' ),
    'id'            => 'sidebar-navigation',
    'description'   => 'Main Navigation Container',
        'class'         => '',
    'before_widget' => '<div>',
    'after_widget'  => '</div>',
    'before_title'  => '<h2 class="widgettitle">',
    'after_title'   => '</h2>' );
    register_sidebar( $args );
}
add_action( 'widgets_init', 'customwidget_init');

see Codex description

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.