WordPress.org

Ready to get started?Download WordPress

Forums

First widget with unique div style (2 posts)

  1. Gareth_Roberts
    Member
    Posted 2 years ago #

    Is it possible to add something like 'before_first_widget' with functions.php?
    I need to give the first widget of each page a different style to the second. I've spent days on this with no joy!

    This is my current code. I can add a '1' to my div but this is global and it's only needed on the second div. Help please!!

    <?php
    for($i =0; $i <2; $i++)
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Sidebar',
    'before_widget' => '<div id="box'.++$i.'">',
    'after_widget' => '</div>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));

  2. keesiemeijer
    moderator
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic