0

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.

0

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

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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