ThemeShaper Forums » Thematic

[closed]

Sidebar layout change

(4 posts)
  • Started 8 years ago by CoreyO
  • Latest reply from CoreyO
  • This topic is not resolved

Tags:

  1. CoreyO
    Member

    First of all this theme is just as complicated as it is great! I just found this theme a few days ago and I'm starting to grasp it now. I am working on a child theme of my own and want my own layout. I figured out how to change around the content portion but I'm having trouble changing the sidebars.

    What I want is a 300px widget area above two thinner widget areas that are side by side and below the side-by-side widget areas shall be another 300px widget area. I know my way around the CSS but locating the files that control the sidebar divs and classes has become fruitless. Any help?

    Posted 8 years ago #
  2. This is a long thread, but it should have the answers you're looking for: http://forums.themeshaper.com/topic/something-new-bout-widgetized-areas

    You'll probably want to rename the "Primary" and "Secondary" widget area to something that makes more sense. Then register a new widget area, that will go below those two and hook it in. The arrangement can all be handled by css.

    I know this is a little vague, but if you have trouble post again. Here's some sample code I used in a project. It's used for a different purpose, but might be helpful so you can see how different areas are registered and renamed and called:

    // Defining Widget Areas
    
    function remove_widget_areas($content) {
    	unset($content['Index Insert']);
    	unset($content['Single Insert']);
    	unset($content['Index Top']);
    	unset($content['Index Bottom']);
    	unset($content['Single Top']);
    	unset($content['Single Bottom']);
    	unset($content['Page Top']);
    	unset($content['Page Bottom']);
    	return $content;
    }
    add_filter('thematic_widgetized_areas', 'remove_widget_areas');
    
    // Renaming and Changing Functionality
    
    function rename_widgetized_areas($content) {
    	$content['Primary Aside']['args']['name'] = 'Image Rotator';
    	$content['Secondary Aside']['args']['name'] = 'Page Sidebar';
    	$content['Secondary Aside']['args']['description'] = 'This widget area appears on pages but not posts.';
    	$content['1st Subsidiary Aside']['args']['name'] = 'Footer First';
    	$content['2nd Subsidiary Aside']['args']['name'] = 'Footer Second';
    	$content['3rd Subsidiary Aside']['args']['name'] = 'Footer Third';
    	$content['Secondary Aside']['function'] = 'childtheme_secondary_aside';
    	return $content;
    }
    add_filter('thematic_widgetized_areas', 'rename_widgetized_areas');
    
    // Register Fourth Footer Widget Area
    
    function add_fourth_subsidiary(){
        register_sidebar(array(
           	'name' => 'Footer Fourth',
           	'id' => '4th-subsidiary-aside',
           	'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
           	'after_widget' => "</li>",
    	'before_title' => thematic_before_title(),
    	'after_title' => thematic_after_title(),
        ));
    }
    add_action('init','add_fourth_subsidiary');
    
    // Output Fourth Footer Widget Area
    
    function output_fourth_subsidiary(){
    	if ( is_sidebar_active('4th-subsidiary-aside') ) { // there are active widgets for this aside
            echo '<div id="fourth" class="aside sub-aside">'. "\n" . '<ul class="xoxo">' . "\n";
            dynamic_sidebar('4th-subsidiary-aside');
            echo '</ul>' . "\n" . '</div><!-- #fourth .aside -->'. "\n";
    	do_action('widget_area_4th_subsidiary_aside');
    	}
    }
    add_action('thematic_after_third_sub', 'output_fourth_subsidiary');
    
    // Register Blog Sidebar Widget Area
    
    function blog_sidebar_widgetarea() {
        register_sidebar(array(
           	'name' => 'Blog Sidebar',
           	'id' => 'blog-sidebar',
           	'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', 'blog_sidebar_widgetarea');
    
    // Register Blog Sidebar Widget Area
    
    function innovations_sidebar_widgetarea() {
        register_sidebar(array(
           	'name' => 'Innovations Center',
           	'id' => 'innovations-sidebar',
           	'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', 'innovations_sidebar_widgetarea');
    
    // Register Blog Sidebar Widget Area
    
    function research_sidebar_widgetarea() {
        register_sidebar(array(
           	'name' => 'Research and Insights',
           	'id' => 'research-sidebar',
           	'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', 'research_sidebar_widgetarea');
    
    // Change Secondary Output to Display Widget Areas Conditionally
    
    function childtheme_secondary_aside() {
    	if (is_sidebar_active('secondary-aside') && is_sidebar_active('blog-sidebar')) {
    		echo thematic_before_widget_area('secondary-aside');
    		if (is_page_template('template-innovationcenter.php.php') || is_page('innovations-center') || is_category('innovations-center') || in_category('innovations-center')) {
    		  	dynamic_sidebar('innovations-sidebar');
    		}  elseif (is_page('research-insights') || is_category('research-insights') || in_category('research-insights')) {
    		  	dynamic_sidebar('research-sidebar');
    		}  elseif (is_page_template('template-blog.php')) {
    		  	dynamic_sidebar('blog-sidebar');
    		}  elseif (is_page()) {
    			dynamic_sidebar('secondary-aside');
    		} else {
    			dynamic_sidebar('blog-sidebar');
    		}
    		echo thematic_after_widget_area('secondary-aside');
    	}
    }
    Posted 8 years ago #
  3. you could add (or repurpose existing) 2 widget areas and add one of each of the thematic_abovemainasides and thematic_belowmainasides action hooks. then in css you could set their widths to the width of the primary + secondary widget areas.

    Posted 8 years ago #
  4. CoreyO
    Member

    Thanks Devin! That thread and your code should get me to learn a bit about this theme. I have also been using your options theme and it's awesome. I'm trying to tackle around with the css to give it some tabs and such for a more organized structure.

    Helga, yeah, I ended up doing what you suggested, which is the least complicated way. Ya gotta love widgets!

    Thanks guys!

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.