Gareth_Roberts
Member
Posted 8 months ago #
I need to apply a new style for the second widget on each page. The first widget on a page will have one style and all additional widgets will have another. There should only be 2 on any page.
The first widget: <div id="firstWidget">
The second widget: <div id="extraWidget">
Currently my functions.php file contains:
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Sidebar',
'before_widget' => '<div id="firstWidget">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>',
));
I've seen users ask the same question but with no responce.
http://wordpress.org/support/topic/increment-div-id-in-functionsphp-or-else-?replies=1
Gareth_Roberts
Member
Posted 8 months ago #
Thanks for the reply. I found this article yesterday but could extract the info I need. I'm afraid my knowledge of PHP is fairly limited.
I've tried adding id="%1$s" but it gives every widget in my site a new number. So I would need to create 30+ styles!!
Any more ideas?
Gareth_Roberts
Member
Posted 8 months ago #
If it helps the web page is http://www.ventureaccounting.co.uk/accountancy-services/
I simply want the second widget to have a new id.
Gareth_Roberts
Member
Posted 8 months ago #
I'm getting closer but still need help.
I've added '.$i.' inside my div
id="box'.$i.'"
I've also added <?php $id=1; $i++ ?> to the start of my funtion.php file.
This adds 1 to my style but no increment(box2, box3...)