Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-28-2010, 04:02 PM   PM User | #1
sohopigeon
New Coder

 
Join Date: Jun 2010
Posts: 31
Thanks: 4
Thanked 0 Times in 0 Posts
sohopigeon is an unknown quantity at this point
Sidebar problem after adding Page Boxes to functions.php

Hi All,

I want to include page boxes not only on my Home Page but other pages too. So I've updated the first few lines in my functions.php file from:

Code:
 
<?php
if ( function_exists('register_sidebar') ) {
   register_sidebar(array(
       'before_widget' => '<li id="%1$s" class="widget %2$s">',
       'after_widget' => '</li>',
       'before_title' => '<h3 class="widgettitle">',
       'after_title' => '</h3>',
   ));
}
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Homepage Boxes',
'before_widget' => '<div class="homepage-box">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
?>
to

Code:
<?php
if ( function_exists('register_sidebars') ) {
   register_sidebars(array(
       'before_widget' => '<li id="%1$s" class="widget %2$s">',
       'after_widget' => '</li>',
       'before_title' => '<h3 class="widgettitle">',
       'after_title' => '</h3>',
   ));
}
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'Homepage Boxes',
'before_widget' => '<div class="homepage-box">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
}
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Page Boxes',
'before_widget' => '<div class="page-box">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
?>
the problem I have is my sidebar text widgets now have an h2 heading not h3...

I don't use h2 anywhere else in the site so I could simply change the stylesheet, but I would rather understand the cause of the problem.

I presume my change to functions.php has somehow caused the problem but I am not sure how. If you have an idea please let me know.

I notice that there is both register_sidebars and register_sidebar (no 's'), I've added an extra register_sidebar. I'm not sure what affect this has.

thank you for continued support developing this site

Kind regards

Will

Last edited by sohopigeon; 06-28-2010 at 04:06 PM.. Reason: add more info
sohopigeon is offline   Reply With Quote
Old 06-28-2010, 05:32 PM   PM User | #2
sohopigeon
New Coder

 
Join Date: Jun 2010
Posts: 31
Thanks: 4
Thanked 0 Times in 0 Posts
sohopigeon is an unknown quantity at this point
Ok I solved my own post, I thank myself, here's the answer for those interested.

First I found this, which answers why the h2:

"The default before/after values are intended for themes that generate a sidebar marked up as a list with h2 titles. This is the convention we recommend for all themes and any theme built in this way can simply register sidebars without worrying about the before/after tags. If, for some compelling reason, a theme cannot be marked up in this way, these tags must be specified when registering sidebars. It is recommended to copy the id and class attributes verbatim so that an internal sprintf call can work and CSS styles can be applied to individual widgets." http://codex.wordpress.org/Function_...gister_sidebar

then I changed register_sidebars to register_sidebar (no 's') in the change I made to functions.php, and it fixed the problem.

:-)
sohopigeon is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:51 PM.


Advertisement
Log in to turn off these ads.