WordPress.org

Ready to get started?Download WordPress

Forums

[closed] [Theme: Toolbox] Add three-column widgets to footer like twentyeleven (8 posts)

  1. CiderJack
    Member
    Posted 2 years ago #

    Need to add 3 columns of widgets to the footer in my child-theme for Toolbox theme. Should work like it's been done in Twentyeleven with 3 footer widget boxes in the admin area.

    Have tried a few solutions offered here in the forum, they all suggest something similar to:
    https://wordpress.org/support/topic/adding-widgets-to-toolbox-theme-as-a-child-theme

    All of them break - that is, if they don't break the site entirely, the footer vanishes completely as soon as I add a widget to the box in the admin area. They also don't create more than one widget box in the admin area. The closest I've come to anything that works is just by copy-pasting the relevant code from twentyeleven into my child-theme like so:

    child-theme functions.php

    <?php
    register_sidebar( array(
    'name' => __( 'Footer Area One', 'toolbox' ),
    'id' => 'sidebar-3',
    'description' => __( 'An optional widget area for your site footer', 'toolbox' ),
    'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    'after_widget' => "</aside>",
    'before_title' => '<h3 class="widget-title">',
    'after_title' => '</h3>',
    ) );

    register_sidebar( array(
    'name' => __( 'Footer Area Two', 'toolbox' ),
    'id' => 'sidebar-4',
    'description' => __( 'An optional widget area for your site footer', 'toolbox' ),
    'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    'after_widget' => "</aside>",
    'before_title' => '<h3 class="widget-title">',
    'after_title' => '</h3>',
    ) );

    register_sidebar( array(
    'name' => __( 'Footer Area Three', 'toolbox' ),
    'id' => 'sidebar-5',
    'description' => __( 'An optional widget area for your site footer', 'toolbox' ),
    'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    'after_widget' => "</aside>",
    'before_title' => '<h3 class="widget-title">',
    'after_title' => '</h3>',
    ) );
    ?>

    In child-theme footer.php (just after the opening <footer id="colophon" role="contentinfo"> tag):

    <?php
    if ( ! is_404() )
    get_sidebar( 'footer' );
    ?>

    And then I copied the sidebar-footer.php file over from twentyeleven completely, changing any code referencing 'twentyeleven' to 'toolbox'.

    The page loads, the Widgets section of the admin panel shows three footer boxes just like it should, but as soon as I drop a widget in any of the footer boxes - boom, the whole footer (including credits/copyright) just vanishes completely.

    Any suggestions greatly welcome!

  2. cinghaman
    Member
    Posted 2 years ago #

    try

    <div style="float:left; width:250px;">
    <?php if (!dynamic_sidebar('Footer Area One')) : ?>
    <aside id="%1$s" class="widget %2$s">
    <h3><?php _e('An optional widget area for your site footer', 'toolbox');?></h3>
    <?php _e('some text '); ?>
    </aside>
    <?php endif; ?>
    
    </div>
    <div style="float:left; width:250px;">
    <?php if (!dynamic_sidebar('Footer Area Two')) : ?>
    <aside id="%1$s" class="widget %2$s">
    <h3><?php _e('An optional widget area for your site footer', 'toolbox');?></h3>
    <?php _e('some text '); ?>
    <?php endif; ?>
    
    </div>
    <div style="float:left; width:250px;">
    <?php if (!dynamic_sidebar('Footer Area Three')) : ?>
    <aside id="%1$s" class="widget %2$s">
    <h3><?php _e('An optional widget area for your site footer', 'toolbox');?></h3>
    <?php _e('some text '); ?>
    <?php endif; ?>

    </div>

  3. CiderJack
    Member
    Posted 2 years ago #

    Thanks Robin! This works great - had been hoping to get the same sort of functionality as twentyeleven, i.e. when one (or all) isn't being used they disappear and the others fill in the difference automatically without having to tinker with the code. (The particular client this is for is rather fickle (and code illiterate) and wants to be able to change things themselves, hence using wordpress to give them this ability via the admin section. They'll likely want to move widgets around every so often without having to come back to me to make a 5-minute adjustment to the code - which I'd rather avoid too.)

    However, this works! Much better than everything I'd been trying. Enough so that I'll go with it unless someone else can provide a more flexible solution.

  4. cinghaman
    Member
    Posted 2 years ago #

    yup you can do that there is a trick to it
    add a blank text widget ;) should work if their is blank text widget it wont show up as such
    make sense ?

  5. CiderJack
    Member
    Posted 2 years ago #

    Ah yes, I see, but that only works to a certain extent. The others don't change width to fill up the space, like they do with twentyeleven, the others fill in the difference automatically.

  6. cinghaman
    Member
    Posted 2 years ago #

    it should be functions
    i havnt worked to extensively with widgets otherwise would have given you a quick solutions
    might look over the weekend though

  7. waheed
    Member
    Posted 1 year ago #

    i need wordpress responsive theme nav menu HOME sample page at right side
    any body have idea

  8. Andrew
    Forum Moderator
    Posted 1 year ago #

    Waheed_imran, create your own thread on your own issue.

Topic Closed

This topic has been closed to new replies.

About this Topic