• Resolved Copywrite

    (@copywrite2012)


    Hi all
    I have the following code in my a sidebar (where the widgets are shown) php file which ic s included in my index page. I only have recent posts and categories in the widgets. The code seems to add html divs but I don’t know where it comes from. Where is the widget code stored? Thank you

    <?php if( is_home() || is_front_page() ) : ?>
    <!--shows if index -->
    <div class="art-sidebar1" style="padding-left: 15px;width:200px;">
    </div>
    
    <?php else : ?>
    
    <?php endif; ?>
    
    <?php if (!art_sidebar(1)): ?>
       <?php _e('Search', 'kubrick'); ?>
    <form method="get" name="searchform" action="<?php bloginfo('url'); ?>/">
    <input type="text" value="<?php the_search_query(); ?>" name="s" style="width: 95%;" />
    	<input class="art-button" type="submit" name="search" value="<?php _e('Search', 'kubrick'); ?>"/>
    </form>
        <?php _e('Bookmarks', 'kubrick'); ?>
    <ul>
          <?php wp_list_bookmarks('title_li=&categorize=0'); ?>
          </ul>
    <?php endif ?>
    </div>
    </div>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Do you have any function called register_sidebar() in the file functions.php of your theme? If so, check this reference, there are two arguments, “before_widget”, and “after_widget” which allow you to change the markup surrounding every widget added in this sidebar.

    http://codex.wordpress.org/Function_Reference/register_sidebar#Parameters

    Thread Starter Copywrite

    (@copywrite2012)

    Thanks that was very useful I just didn’t understand where it was coming from. I have now got rid of all the garbage formatting and left it like this:

    if (function_exists('register_sidebars')) {
    	register_sidebars(1, array(
    		'before_widget' => '<div id="%1$s" style="width:250px;float:left;">'.'<!--- BEGIN Widget --->',
    		'before_title' => '<!--- BEGIN WidgetTitle --->',
    		'after_title' => '<!--- END WidgetTitle --->',
    		'after_widget' => '<!--- END Widget --->'.'</div>'
    	));
    }

    Great ! So, problem resolved?

    Thread Starter Copywrite

    (@copywrite2012)

    Yes thank you

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Sidebar – widget adding css’ is closed to new replies.