ThemeShaper Forums » Thematic

[closed]

Can I add a 4th Subsidiary?

(14 posts)
  • Started 13 years ago by katiek648
  • Latest reply from petskratt
  • This topic is resolved
  1. katiek648
    Member

    I'm using Thematic and wish to have 4 widgets displayed on the bottom of the page. How do I add a 4th Subsidiary? I'm no pro at PHP. I think I was able to add one by updating the /library/extensions/sidebar-extensions.php and sidebar-subsidiary.php pages with no error, but I haven't figured out how to add that to the backend CMS to edit.

    I guess my other option is to use another sidebar and just edit the css.

    Thanks in advance!
    Katie

    Posted 13 years ago #
  2. katiek648
    Member

    Can someone help with this? I'd like to get an additional widget in the footer, but there are only 3 subsidiaries. What is the best way to do this? I was thinking I could move the Page Bottom widget down there, but I'm not sure how to do that.

    dev.lonjeviteakombucha.com
    I'd like to move the Contact Us widget right next to the Twiter Updates

    Thanks!

    Posted 13 years ago #
  3. It looks like you've already got this one figured out on your site, but it can be done with a small plugin. This works for me on a test server, but if there is a better way then others should feel free to point it out :):

    <?php
    /*
    Plugin Name: Add 4th Subsidiary
    Version: 0.1
    */
    
    // register the widget area...
    function add_fourth_subsidiary(){
        register_sidebar(array(
           	'name' => '4th Subsidiary Aside',
           	'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 the sidebar after the third subsidiary 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');
    ?>

    The way it works would not allow the fourth subsidiary to show up on the page if none of the first three were being used, but if you need a fourth area that's not very likely to be the case. :)

    Posted 13 years ago #
  4. Thanks!
    Works perfect for me
    :-)

    Posted 13 years ago #
  5. Thank you so much! I know it's a little late since this post but it helped me so much with a client's project that I had to say thanks.

    Posted 12 years ago #
  6. This is awesome... Just tried it and it works perfectly. Thanks a lot!

    Posted 12 years ago #
  7. secondtail
    Member

    I just wanted to post something that just worked wonders for me. I needed not just four, but five widget areas in my footer. It's kind of complicated, but I think anyone can handle it.

    Step one: Locate your widget-extensions file in library > extensions > widget-extensions.php. Open it up in whatever you use. Locate the following (on or around line 97):

    '3rd Subsidiary Aside' => array(
    'admin_menu_order' => 500,
    'args' => array (
    'name' => '3rd Subsidiary Aside',
    'id' => '3rd-subsidiary-aside',
    'description' => __('The 3rd 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_3rd_subsidiary_aside',
    'priority' => 70,
    ),

    Copy it, and paste it below the above code for each new subsidiary aside you need to make.

    Step two: Change the numbers to whatever number aside it needs to correspond to. If you're making a fourth aside, it'll look like the following:

    '4th Subsidiary Aside' => array(
    'admin_menu_order' => 600,
    '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' => 90,
    ),

    Step 3: Correct the admin menu orders and priorities. In the above code, it's already corrected. It's menu ordered at 600, and prioritized at 90. You'll have to change these for every item below it, too. Admin menu orders go in increments of 100, and priorities at increments of 20. Should look like this:

    '5th Subsidiary Aside' => array(
    'admin_menu_order' => 700,
    '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' => 110,
    ),
    '6th Subsidiary Aside' => array(
    'admin_menu_order' => 800,
    'args' => array (
    'name' => '6th Subsidiary Aside',
    'id' => '6th-subsidiary-aside',
    'description' => __('The 6th 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_6th_subsidiary_aside',
    'priority' => 130,
    ),
    'Index Top' => array(
    'admin_menu_order' => 900,
    'args' => array (
    'name' => 'Index Top',
    'id' => 'index-top',
    'description' => __('The top widget area displayed on the index page.', '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_index_top',
    'function' => 'thematic_index_top',
    'priority' => 10,
    ),
    'Index Insert' => array(
    'admin_menu_order' => 1000,
    'args' => array (
    'name' => 'Index Insert',
    'id' => 'index-insert',
    'description' => __('The widget area inserted after x posts on the index page.', 'thematic'),
    'before_widget' => thematic_before_widget(),
    'after_widget' => thematic_after_widget(),
    'before_title' => thematic_before_title(),
    'after_title' => thematic_after_title(),
    ),

    and so on until everything is correct.

    Step four: Further down in the same file, find the following code:

    // Define the 3rd Subsidiary Aside
    function thematic_3rd_subsidiary_aside() {
    if (is_active_sidebar('3rd-subsidiary-aside')) {
    echo thematic_before_widget_area('3rd-subsidiary-aside');
    dynamic_sidebar('3rd-subsidiary-aside');
    echo thematic_after_widget_area('3rd-subsidiary-aside');
    }
    }

    Copy and paste it and change the appropriate numbers like so:

    // 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');
    }
    }

    Step 5: Go into library > layouts > xxxxxx.css and find whichever layout you are using. Change the width of the subsidiary aside to whatever you need it to be to make your site display the way you want it to.

    And that it how I made additional widget areas without needing a plugin!

    Posted 12 years ago #
  8. yashmistrey
    Member

    hey friend i am using another theme

    i want to create widget area to add ad/rss fatch between posts like 'index-insert'

    i have read this this, (5. Insert Ads Between Posts) http://www.smashingmagazine.com/2009/07/14/5-useful-and-creative-ways-to-use-wordpress-widgets/#highlighter_309537

    but failed to do as it's not well defined, i think

    for example see this http://net.tutsplus.com/ and search 'Popular Posts this Month'

    how can i do like this ?

    Posted 12 years ago #
  9. you are using another theme? you realize this forum is for the Thematic theme? if you use thematic you will already have index insert out of the box.

    Posted 12 years ago #
  10. I am trying to add a 4th subsidiary aside per secondtail's instructions. The 4th subsidiary is not showing up in the widget interface.

    Here is my process...
    I copied the widgets-extensions.php from thematic parent folder. I placed it in my child > library > extensions > widgets-extensions.php.

    I made the changes to the widgets-extensions.php. and uploaded it.
    I followed step 1,2 & 3.
    I changed 'admin_menu_order' => 600,and 'priority' => 90,
    I then continued to changed the Admin menu orders in increments of 100.
    Index top 700, ending with page bottom 1400.

    I did not change the 'priority' => 10 for Index top thru page bottom as they all look to remain the same. Then completed step 4.

    Secondtail's instructions doesn't finish the process so I am guessing the priority remains the same. I completed the process twice to make sure I followed instructions.

    Can someone verify Secondtails code?
    Or offer some helpful instructions?

    Thanks in advance.

    Posted 12 years ago #
  11. I thought I might try Krusty Ruffle plugin solution while I am waiting for a replay to the above post about Secondtail's solution.

    I have a few questions...
    Where do I put Krusty Ruffle's code? in my function.php or some where else?

    Posted 12 years ago #
  12. I just tested Krusty Ruffle solution for a 4th widget slot, it does work perfect.

    All you need to do is drop his code in the Child Themes functions.php file.

    Posted 12 years ago #
  13. Thank you ScottNix for testing the Krusty Ruffle solution for me!

    Posted 12 years ago #
  14. Thematic seems to have a callback that lets you push your 4th widget into array ... and it seems to produce just very fine widgets indeed (tweaking priority determines order of widgets withing particular area, so you can make it 2,5th Subsidiary if you wish; and action_hook determines where exactly this additional widget is being output, for possible options see the array at the beginning of widgets-extensions.php under Thematic):

    // add 4th widgetized area to the footer
    
    function thematic_add_widgetized_areas_to_array($content) {
    
        $content['4th Subsidiary Aside'] = array(
    			'admin_menu_order' => 550,
    			'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'		=> 80
    		);
    
    	return $content;
    }
    
    add_filter('thematic_widgetized_areas', 'thematic_add_widgetized_areas_to_array', 50);
    
    function thematic_4th_subsidiary_aside() {
    	if (is_active_sidebar('4th-subsidiary-aside')) {
    		echo "\n".'<div id="fourth" class="aside sub-aside">' . "\n" . "\t" . '<ul class="xoxo">' . "\n";
    		dynamic_sidebar('4th-subsidiary-aside');
    		echo "\n" . "\t" . '</ul>' ."\n" . '</div><!-- #fourth .aside -->' ."\n";
    	}
    }

    well, and then do whatever you like with CSS :-)

    Posted 12 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.