• I am working on a theme from scratch and I just implemented a widgetized sidebar, but whenever I try to add a widget to the sidebar, it disappears when I come back to the page.

    Below is my code:

    functions.php:

    <?php
    $sidebar = array(
    'name'          => 'Sidebar',
    'id'            => 'sidebar-$i',
    'before_widget' => '<li id=\"%1$s\" class=\"widget %2$s\">',
    'after_widget'  => '',
    'before_title'  => '<h2 class=\"widgettitle\">',
    'after_title'   => '</h2>'
    );
    
    if(function_exists('register_sidebar')){
       register_sidebar($sidebar);
    }
    ?>

    sidebar.php:

    <div id="pagesidebar">
       <ul id="sidebar">
          <?php if(!function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    
    <li>{static sidebar item 1}</li>
    <li>{static sidebar item 2}</li>
          <?php endif; ?>
    
    </div>

    I am pretty sure I am doing something wrong, since widgets stay in Kubrick.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Widgets Disappear from Sidebar’ is closed to new replies.