ThemeShaper Forums » Thematic

[closed]

Can I make a 5 column subsidiary widget?

(6 posts)
  • Started 2 years ago by larand54
  • Latest reply from larand54
  • This topic is resolved
  1. larand54
    Member

    I want to extend the existing 3-column subsidiary to a 5-column one.
    I don't want to make any changes in the original code.
    I want to use a child theme where I can add some necessary code to make it work.

    My question is:
    Is that possible and if it is I need some tip how to do it?
    Else,
    Would it be better if I creates new widget-areas for the footer? I only need to use the text-widget so I don't need to create some new widgets.

    Thanks in advance!

    Posted 2 years ago #
  2. sure it's possible. i'd just register 2 new widget areas. then adjust the CSS

    http://forums.themeshaper.com/topic/something-new-bout-widgetized-areas#post-6660

    Posted 2 years ago #
  3. larand54
    Member

    Thank you Helga,

    I have now succeded in implementing the 5-column subsidiary.
    It worked like a charm.

    Here is the code I had made for this:

    function add_4th_subsidiary_aside($content) {
        $content['4th Subsidiary Aside'] = array(
            'admin_menu_order' => 510,
    		'args' => array (
    			'name' => '4th Subsidiary Aside',
    			'id' => '4th-subsidiary-aside',
                'description' => __('The 4th widget area in the footer.', 'thematic'),
    			'before_widget' => thematic_before_widget(),
    			'after_widget' => thematic_after_widget(),
    			'before_title' => thematic_before_title(),
    			'after_title' => thematic_after_title(),
    		),
    		'action_hook'	=> 'widget_area_subsidiaries',
    		'function'		=> 'thematic_4th_subsidiary_aside',
    		'priority'		=> 75,
        );
        return $content;
    }
    
    add_filter('thematic_widgetized_areas', 'add_4th_subsidiary_aside');
    
    // Define the 4th Subsidiary Aside
    function thematic_4th_subsidiary_aside() {
    	if (is_active_sidebar('4th-subsidiary-aside')) {
    		echo thematic_before_widget_area('4th-subsidiary-aside');
    		dynamic_sidebar('4th-subsidiary-aside');
    		echo thematic_after_widget_area('4th-subsidiary-aside');
    	}
    }
    
    function add_5th_subsidiary_aside($content) {
        $content['5th Subsidiary Aside'] = array(
            'admin_menu_order' => 520,
    		'args' => array (
    			'name' => '5th Subsidiary Aside',
    			'id' => '5th-subsidiary-aside',
                'description' => __('The 5th widget area in the footer.', 'thematic'),
    			'before_widget' => thematic_before_widget(),
    			'after_widget' => thematic_after_widget(),
    			'before_title' => thematic_before_title(),
    			'after_title' => thematic_after_title(),
    		),
    		'action_hook'	=> 'widget_area_subsidiaries',
    		'function'		=> 'thematic_5th_subsidiary_aside',
    		'priority'		=> 79,
        );
        return $content;
    }
    
    add_filter('thematic_widgetized_areas', 'add_5th_subsidiary_aside');
    
    // Define the 5th Subsidiary Aside
    function thematic_5th_subsidiary_aside() {
    	if (is_active_sidebar('5th-subsidiary-aside')) {
    		echo thematic_before_widget_area('5th-subsidiary-aside');
    		dynamic_sidebar('5th-subsidiary-aside');
    		echo thematic_after_widget_area('5th-subsidiary-aside');
    	}
    }

    All code is added into the functions.php in the child-themes map.

    Thank's again!

    Posted 2 years ago #
  4. larand54
    Member

    Ok, I also the changes I made on style.css.
    The most important is ofcourse the width which I had to set to 172px.

    #subsidiary {
        padding:    10px;
    }
    
    #subsidiary .aside {
        width:      172px;
        margin:     0 20px 0 0;
        color:      #655240;
        font:       Verdana, Arial, Helvetica sans-serif;
        text-align: center;
    }
    
    #subsidiary .widgettitle {
        font-size:  11px;
        color:      #f00;
    }
    
    #subsidiary .textwidget {
        font-size:  8pt;
    }
    Posted 2 years ago #
  5. larand54, excellent work. one tip, you can easily combine your two filter functions (the ones that create the new widgets) into 1 function.

    // Define the 4th and 5th Subsidiary Asides
    
    add_filter('thematic_widgetized_areas', 'add_subsidiary_asides');
    
    function add_subsidiary_asides($content) {
    	$content['4th Subsidiary Aside'] = array(
            'admin_menu_order' => 510,
    		'args' => array (
    			'name' => '4th Subsidiary Aside',
    			'id' => '4th-subsidiary-aside',
                'description' => __('The 4th widget area in the footer.', 'thematic'),
    			'before_widget' => thematic_before_widget(),
    			'after_widget' => thematic_after_widget(),
    			'before_title' => thematic_before_title(),
    			'after_title' => thematic_after_title(),
    		),
    		'action_hook'	=> 'widget_area_subsidiaries',
    		'function'		=> 'thematic_4th_subsidiary_aside',
    		'priority'		=> 75,
        );
    
        $content['5th Subsidiary Aside'] = array(
            'admin_menu_order' => 520,
    		'args' => array (
    			'name' => '5th Subsidiary Aside',
    			'id' => '5th-subsidiary-aside',
                'description' => __('The 5th widget area in the footer.', 'thematic'),
    			'before_widget' => thematic_before_widget(),
    			'after_widget' => thematic_after_widget(),
    			'before_title' => thematic_before_title(),
    			'after_title' => thematic_after_title(),
    		),
    		'action_hook'	=> 'widget_area_subsidiaries',
    		'function'		=> 'thematic_5th_subsidiary_aside',
    		'priority'		=> 79,
        );
        return $content;
    }
    Posted 2 years ago #
  6. larand54
    Member

    Ahaa! That's good - will save some code then.

    Will take a breake now, on my way home by train and will celebrate the weekend ;-)

    A long week with 5 long days is finally put to and end :-)

    Have a nice weekend to you and thank's for your help

    /LG

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.