ThemeShaper Forums » Power Blog

New Widget Area in Category and Navigation Bar

(6 posts)
  • Started 10 years ago by freedimensional
  • Latest reply from Tomcat23
  1. Hi all,

    I'm struggling to get my Power Blog install to pick up on the widget areas I've tried to implement. Is there a way to insert a widget area in line with the Nav bar, and another in line with Power Blog's Category bar?

    Best,
    Tom

    Posted 10 years ago #
  2. I should add my code - this example seeks to place a 'Header Aside' in the access div:

    // CUSTOM INCLUSION >> This will create a new 'Header Aside' widget area
    function my_widgets_init() {
    	register_sidebar(array(
           	'name' => 'Header Aside',
           	'id' => 'header-aside',
           	'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');
    
    // CUSTOM INCLUSION >> adding the new 'Header Aside' widget area to the child theme
    function my_header_widgets() {
    if ( function_exists('dynamic_sidebar') && is_sidebar_active('header-aside') ) {
        echo '<div id="header-aside" class="aside">'. "\n" . '<ul class="xoxo">' . "\n";
        dynamic_sidebar('header-aside');
        echo '' . "\n" . '</ul>'. "\n";
        echo '' . "\n" . '</div><!-- #header-aside .aside -->'. "\n";
    }
    }
    add_action('thematic_access', 'my_header_widgets', 0);

    Best regards, and thanks in advance,
    Tom

    Posted 10 years ago #
  3. Sorted. But, I spotted a pretty big problem whilst doing so.

    I've created a WordPress plugin called Subscription Options, and in creating my new 'Header Aside' and positioning it into the navigation bar, I realised that the Suckerfish controls would actually stop users from clicking any links positioned into the access section.

    What can be done about this?

    Tom

    Posted 10 years ago #
  4. Hi Tom,

    don't know what you're doing to get a none clickable icon .. you could try this code instead:

    // Remove default Thematic actions
    function remove_thematic_actions() {
        remove_action('thematic_header','thematic_access',9);
    }
    add_action('init','remove_thematic_actions');
    
    // Create a custom access div with the menu and search box
    function search_access() { ?>
        	<div id="access">
        		<div class="skip-link"><a href="#content" title="<?php _e('Skip navigation to the content', 'thematic'); ?>"><?php _e('Skip to content', 'thematic'); ?></a></div>
                <?php wp_page_menu('sort_column=menu_order') ?>
    
    			<?php if ( function_exists('dynamic_sidebar') && is_sidebar_active('header-aside') ) {
    				echo '<div id="header-aside" class="aside">'. "\n" . '<ul class="xoxo">' . "\n";
    				dynamic_sidebar('header-aside');
    				echo '' . "\n" . '</ul>'. "\n";
    				echo '' . "\n" . '</div><!-- #header-aside .aside -->'. "\n";
    			} ?>
            </div><!-- #access -->
    <?php }
    add_action('thematic_header','search_access',9);
    
    // CUSTOM INCLUSION >> This will create a new 'Header Aside' widget area
    function my_widgets_init() {
    	register_sidebar(array(
           	'name' => 'Header Aside',
           	'id' => 'header-aside',
           	'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');

    This is basically what Cristian explains in his post "Add"

    Haven't played with the CSS for positioning everything.

    Cheers,

    Chris

    Posted 10 years ago #
  5. Hi all,

    I've created a new widget area and it's working great. I've filled it with a plugin I wrote called 'Subscription Options'. I've even build my own CSS to position it perfectly in Power Blog's Category Navigation bar.
    The problem I've hit upon, as we all often do, is cross-browser compatibility.

    I've nailed Firefox, Safari and IE, but it's Chrome that is causing me problems.

    Can anyone tell me how to either optimise my CSS, or to create a new stylesheet just for Chrome?

    Thanks, as ever,
    Tom

    Posted 10 years ago #
  6. Oh, I had almost posted a huge question about how to activate a function from a plugin, as I wanted wp-spamfree to display inside the header... But if I can get wordpress to render it in a text widget...! I think this will solve my problem. What an amazing post, Chris! I'm going to try this out right now!

    Posted 10 years ago #

RSS feed for this topic

Reply

You must log in to post.