I want my list formating back! (dual sidebars)
-
Hey guys,
I’ve just been messing around this morning setting up multiple sidebars, which I’m going to populate and serve up to pages using the is_page() conditional. Code below for everyone’s reference:
functions.php
register_sidebars(2, array('name'=>'Sidebar %d'));
index.php & page.php
// the 2 references sidebar 2 in the widgets panel in your dashboard<?php // display sidebar 2 (left sidebar) if ( function_exists('dynamic_sidebar') && dynamic_sidebar(<strong>2</strong>) ) : else : ?> <?php endif; ?>
… now, my problem. Doing it this way has taken away all my list formating; seen previously in the default sidebar setup:
if ( function_exists('register_sidebar') ) register_sidebar(array( 'before_widget' => '<li id="%1$s" class="widget %2$s">', 'after_widget' => '</li>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>', ));
I want this back, cause ATM my formating sucks. These are the two pieces of HTML pumped out:
<!-- conventional sidebar --> <div id="sidebar"> <ul> <li id="text-406465381" class="widget widget_text"> <h2 class="widgettitle">Left sidebar1</h2> <div class="textwidget">Left sidebar1</div> </li> </ul> </div>
<!-- newly generated sidebar --> <li id="text-406475901" class="widget widget_text"> <h2 class="widgettitle">Right sidebar2</h2> <div class="textwidget">Right sidebar2</div> </li>
I need to surround this latter chunk of HTML with similar stuff to the first; a < div > and a < ul > ideally, like the HTML output for the conventional sidebar. Obviously there’s gonna be some conflicts with the sidebar IDs, which need to be unique. So factor that in if you can help me out here.
Still sucks a bit you can’t give more meaningful names to the widgets you drop in though – text-406465381 does suck quite a bit?!
Thanks in advance.
LPS. Apologies for using the word ‘suck’ copiously in this post, haha.
- The topic ‘I want my list formating back! (dual sidebars)’ is closed to new replies.