ThemeShaper Forums » Power Blog

[closed]

Making a new widget area in Power Blog

(11 posts)
  • Started 4 years ago by freedimensional
  • Latest reply from daveread
  1. Hi all,

    I am now a proud user of the Power Blog Theme.

    There are four additional widget areas including a new 'Crown Aside' that sits above both the Primary (left) and Secondary (right) Asides.

    I would like to create a fifth additional widget area below each of the main asides, however my attempts at editing the functions.php throw up some funny results.

    Can anyone help me create a new 'Below Aside'?

    Thank you in advance,
    Tom

    Posted 4 years ago #
  2. Hey Tom,

    try this one:

    // This will create your widget area
    function my_widgets_init() {
        register_sidebar(array(
           	'name' => 'Below MainAside',
           	'id' => 'below-mainaside',
           	'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
           	'after_widget' => "</li>\n",
    		'before_title' => "<h3 class=\"widgettitle\">",
    		'after_title' => "</h3>\n",
        ));
    
    }
    add_action( 'init', 'my_widgets_init' );
    
    // adding the widget area to your child theme
    function my_sidebar_widgets() {
    if ( function_exists('dynamic_sidebar') && is_sidebar_active('below-mainaside') ) {
        echo '<div id="below-mainaside" class="aside">'. "\n" . '<ul class="xoxo">' . "\n";
        dynamic_sidebar('header-aside');
        echo '' . "\n" . '</ul>'. "\n";
        echo '' . "\n" . '</div><!-- #below-mainaside .aside -->'. "\n";
    }
    }
    add_action('thematic_belowmainasides', 'my_sidebar_widgets');

    Haven't tested this one, it's a rewrite of my widgetized area in the header.

    You might want to change the markup according to your needs.

    Cheers,

    Chris

    Posted 4 years ago #
  3. Hi Chris,

    Thanks as always for the helping hand.

    Unfortunately the code has not resolved my problem, because the widget area (with a text widget activated within it) does not appear in thematic_belowmainasides.

    Perhaps it is to do with the following code from the functions.php:

    // Close div#sidebar
    function childtheme_sidebarend() { ?>
    </div><!-- #sidebar -->
    <?php }
    add_action('thematic_belowmainasides','childtheme_sidebarend');

    Perhaps you could take a look at my blog?
    It's http://digitalcortex.net.

    Thank you once again,
    Tom

    Posted 4 years ago #
  4. Sorry .. forgot to change one sidebar name (reason why below-mainaside didn't display) and added a prio to the action (below-mainaside will now be in the sidebar area).

    This code is tested:

    // This will create your widget area
    function my_widgets_init() {
        register_sidebar(array(
           	'name' => 'Below MainAside',
           	'id' => 'below-mainaside',
           	'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
           	'after_widget' => "</li>\n",
    		'before_title' => "<h3 class=\"widgettitle\">",
    		'after_title' => "</h3>\n",
        ));
    
    }
    add_action( 'init', 'my_widgets_init');
    
    // adding the widget area to your child theme
    function my_sidebar_widgets() {
    if ( function_exists('dynamic_sidebar') && is_sidebar_active('below-mainaside') ) {
        echo '<div id="below-mainaside" class="aside">'. "\n" . '<ul class="xoxo">' . "\n";
        dynamic_sidebar('below-mainaside');
        echo '' . "\n" . '</ul>'. "\n";
        echo '' . "\n" . '</div><!-- #below-mainaside .aside -->'. "\n";
    }
    }
    add_action('thematic_belowmainasides', 'my_sidebar_widgets', 0);

    Cheers,

    Chris

    Posted 4 years ago #
  5. Awesome - thanks a lot!

    Quick note on implementing this:
    If you copy the stylings for the existing 'Crown Aside' and rename them 'Below-MainAside' make sure you modify your border-top or you'll end up with 2px of border rather than 1px.

    Best,
    Tom

    Posted 4 years ago #
  6. Thanks Tom ! Good advice and great idea to have a Below-MainAside widget, I implemented it on my blog and am very happy with it :)

    cheers,

    Tom

    Posted 4 years ago #
  7. hi,
    i tried to get the widgetarea working, and it does, but i want it to have a border at the top. how can i fix that?
    thanks a lot
    jan

    Posted 4 years ago #
  8. I think i can follow all that, but I’m puzzled in which *.php this should go and where.

    Posted 4 years ago #
  9. This goes into the functions.php of the Power Blog Theme.

    Cheers,

    Chris

    Posted 4 years ago #
  10. Dang, right. I knew that I read that somewhere… couldn’t recall. Sorry & thanks, Chris.

    Posted 4 years ago #
  11. Chris,

    Is there a way to add the belowmainasides widget when there already is the added header-asides widget? I get the error message " ... my_widgets_init" already declared. When I delete the header-aside, your belowmainasides widget works fine.

    Thanks, Dave

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.