WordPress.org

Support

Support » How-To and Troubleshooting » Sidebar spacing (for widgets)

Sidebar spacing (for widgets)

  • Hi there

    I’m new to WordPress although I’m in the process of getting two sites up and running.

    For the business site, there is an issue with the spacing with widgets in the sidebar. I can insert the social icons no problem but anything else just looks a complete mess on the live site. There appears to be no spacing built into the theme for more than one widget without it looking appalling!

    Not knowing anything about code, I’m not sure how to rectify this. The sidebar code is below and the website is http://www.palomanewbusiness.com.

    If anyone can help that would be lovely.

    Charly

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <div class="sidebar">
     <?php if (!dynamic_sidebar('primary-widget-area')) : ?>
            <?php get_search_form(); ?>
            <h3>
                <?php _e('Categories', 'black-bird'); ?>
            </h3>
    
    <ul>
                <?php wp_list_categories('title_li'); ?>
            </ul>
            <h3>
                <?php _e('Archives', 'black-bird'); ?>
            </h3>
    
    <ul>
                <?php wp_get_archives('type=monthly'); ?>
            </ul>
        <?php endif; // end primary widget area ?>
        <?php
    // A second sidebar for widgets, just because.
        if (is_active_sidebar('secondary-widget-area')) :
            ?>
            <?php dynamic_sidebar('secondary-widget-area'); ?>
        <?php endif; ?>
             </div>

Viewing 10 replies - 1 through 10 (of 10 total)
  • Can you put some widgets in your sidebar on your blog so I can see it?

    Thanks Aaron

    This is what I’d like in the blog section of the site http://www.palomanewbusiness.com/theblog/

    As you can see it’s not looking too happy!

    Cheers

    Charly

    Well I can tell you that your theme is not working correctly.

    The output of the widget’s is not including the class name.

    It is showing
    <div class="">

    Should be
    <div class="widget">

    The CSS file has the right padding and such so this is the issue.

    I downloaded the theme and I don’t understand why it is like this but to fix it you need to edit blackbird-functions.php

    Find

    register_sidebar(array(
            'name' => __('Primary Widget Area', 'black-bird'),
            'id' => 'primary-widget-area',
            'description' => __('The primary widget area', 'black-bird'),
            'before_widget' => '<div class="">',
            'after_widget' => '</div>',
            'before_title' => '<h3>',
            'after_title' => '</h3>',
        ));
    // Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
        register_sidebar(array(
            'name' => __('Secondary Widget Area', 'black-bird'),
            'id' => 'secondary-widget-area',
            'description' => __('The secondary widget area', 'black-bird'),
            'before_widget' => '<div class="">',
            'after_widget' => '</div>',
            'before_title' => '<h3>',
            'after_title' => '</h3>',
        ));

    Fix the before_widget like I put above and try again.

    Thanks Aaron that’s really helpful, I’ll give it a go.

    Charly

    Hi there

    I’ve updated the above code (as shown below) but I’m still having sidebar spacing problems – see http://www.palomanewbusiness.com/theblog/

    I don’t know if this has anything to do with the fact the social widgets are not from Blackbird or because I have the Blackbird Pro theme or because I need to edit the code below further?

    Any help gratefully received 🙂

    Thanks
    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    function blackbird_widgets_init() {
    // Area 1, located at the top of the sidebar.
        register_sidebar(array(
            'name' => __('Primary Widget Area', 'black-bird'),
            'id' => 'primary-widget-area',
            'description' => __('The primary widget area', 'black-bird'),
            'before_widget' => '<div class="widget">',
            'after_widget' => '</div>',
            'before_title' => '<h3>',
            'after_title' => '</h3>',
        ));
    // Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
        register_sidebar(array(
            'name' => __('Secondary Widget Area', 'black-bird'),
            'id' => 'secondary-widget-area',
            'description' => __('The secondary widget area', 'black-bird'),
            'before_widget' => '<div class="widget">',
            'after_widget' => '</div>',
            'before_title' => '<h3>',
            'after_title' => '</h3>',
        ));

    Moderator Jan Dembowski

    @jdembowski

    Volunteer Mod. & Brute Squad

    For the business site, there is an issue with the spacing with widgets in the sidebar.

    As the BlackBird Pro is a commercial theme have you asked at their dedicated forums? For spacing or presentation issues that’s usually just a matter of CSS.

    http://www.inkthemes.com/community

    We don’t support commercial themes here in these forums. I’m not being obtuse but when you purchased that theme support was included and you may as well exercise that option. It’s part of what you paid for.

    Thanks Jan, makes sense – I’ve posted on their forum. Annoying considering it was a paid for theme!

    Have a good weekend 🙂

    It didn’t add that class into the output so that might not be the right spot. There were some other ones below them too, i’d make sure you change them all just to try while you wait for their support.

    Thanks Aaron, no response from the Blackbird people thus far.

    Just to clarify, do you mean I should add the class=”widget” to the ‘after widgets’ code or something else entirely?

    Thanks

    Charly

    What you have below is correct.

    'before_widget' => '<div class="widget">',

    But there are more widgets than just those 2 and I didn’t read what all of them did. So I would just add it to all before_widget lines on that page.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Sidebar spacing (for widgets)’ is closed to new replies.