ThemeShaper Forums » Thematic

[closed]

moving subsidiary asides above thematic footer.

(20 posts)
  • Started 5 years ago by Justin
  • Latest reply from ScottNix
  • This topic is resolved
  1. Justin
    Member

    Hello,

    Struggling to find the best way to move the subsidiary aside out of the footer and placing it (and its sub-asides) above the footer.

    Trying to avoid adding new widgets and custom pages. Simply wish to move the subsidiary asides up using functions if at all possible.

    I can specify the exact location I'm targeting for subsidiary section in the functions file. Also grasp removal and add via PHP. Just not sure how to call the subsidiary section using a filter or hook.

    Any suggestions? Thank you!

    Posted 5 years ago #
  2. Justin
    Member

    UPDATED QUESTION: Actually I would be find to keep the subsidiary asides where they are in the footer if i could figure out how to filter the display based on page. I am probably missing something simple as i am not having problems filtering the sidebar... Does anyone have any ideas on the best way to filter this specific section?

    Posted 5 years ago #
  3. Justin
    Member

    UPDATED QUESTION 2... Ok sorry togo at this one more time...

    To filter which pages display the subsidiary asides I have to update the footer copied into my child theme using php like this:

    ...<div id="footer">
    <?php
    // Begin Filtering Display of Features (Subsidiary Asides)
    if (is_page('home'))
    get_sidebar('subsidiary')
    // End Features Filtering
    ?>
    <div id="siteinfo">...

    I don't want to hack the footer, but the only other thing I can think to do without hacking themeshaper is maybe to create a new widget area and I doubt I have much more time to understand creating a widget area.

    It seems like it would be much easier to use a hook and place the the existing subsidiary aside where I want it, and on which pages I want using the functions.php. I simply cant figure out how to filter the subsidiary sidebar out of the footer once I add it elsewhere using the functions.php file.

    Any good suggestions on this will truly make my day! Thank you in advance!

    Posted 5 years ago #
  4. Hi Justin,

    I'm currently working on Thematic to implement the needed functionality. The code for the footer is ready to go. Need a bit more time to sort out the widget area code.

    Chris

    Posted 5 years ago #
  5. Hey Justin, how are you?

    I had he same need as you for creating widgetized areas above the footer so here is what I did with Chris's kind help:

    First, make sure you get the lates SVN copy of thematic. If you don't know how to do it look at this post: http://forums.themeshaper.com/topic/how-to-get-the-latest-svn-copy-of-thematic

    Then, put this into your child theme's function.php file between the <?php and ?>

    function create_my_widgetized_areas($content) {
    	$content['1st Above Footer Aside'] = array(
      	'admin_menu_order' => 510,
    		'args' => array (
    			'name' => '1st Above Footer Aside',
    			'id' => 'first-above-footer-aside',
    			'before_widget' => thematic_before_widget(),
    			'after_widget' => thematic_after_widget(),
    			'before_title' => thematic_before_title(),
    			'after_title' => thematic_after_title(),
    		),
    		'action_hook'	=> 'above_footer_widgets',
    		'function'		=> 'add_widgetized_areas',
    		'priority'		=> 10,
    	);
    		$content['2nd Above Footer Aside'] = array(
      	'admin_menu_order' => 520,
    		'args' => array (
    			'name' => '2nd Above Footer Aside',
    			'id' => 'second-above-footer-aside',
    			'before_widget' => thematic_before_widget(),
    			'after_widget' => thematic_after_widget(),
    			'before_title' => thematic_before_title(),
    			'after_title' => thematic_after_title(),
    		),
    		'action_hook'	=> 'above_footer_widgets',
    		'function'		=> 'add_widgetized_areas',
    		'priority'		=> 10,
    	);
    		$content['3rd Above Footer Aside'] = array(
      	'admin_menu_order' => 530,
    		'args' => array (
    			'name' => '3rd Above Footer Aside',
    			'id' => 'third-above-footer-aside',
    			'before_widget' => thematic_before_widget(),
    			'after_widget' => thematic_after_widget(),
    			'before_title' => thematic_before_title(),
    			'after_title' => thematic_after_title(),
    		),
    		'action_hook'	=> 'above_footer_widgets',
    		'function'		=> 'add_widgetized_areas',
    		'priority'		=> 10,
    	);
    	return $content;
    }
    add_filter('thematic_widgetized_areas', 'create_my_widgetized_areas');
    
    // And this is our new function that displays the widgetized area
    function add_widgetized_areas() {
    	if (is_sidebar_active('first-above-footer-aside')) {
    		echo thematic_before_widget_area('first-above-footer-aside');
    		dynamic_sidebar('first-above-footer-aside');
    		echo thematic_after_widget_area('first-above-footer-aside');
    	}
    	if (is_sidebar_active('second-above-footer-aside')) {
    		echo thematic_before_widget_area('second-above-footer-aside');
    		dynamic_sidebar('second-above-footer-aside');
    		echo thematic_after_widget_area('second-above-footer-aside');
    	}
    	if (is_sidebar_active('third-above-footer-aside')) {
    		echo thematic_before_widget_area('third-above-footer-aside');
    		dynamic_sidebar('third-above-footer-aside');
    		echo thematic_after_widget_area('third-above-footer-aside');
    	}
    }
    
    // Creates the Above footer Widgets Action Hook
    function above_footer_widgets() {
        do_action('above_footer_widgets');
    } // end thematic_abovefooter
    
    // Creates the above footer widgets container
    function above_footer_widgets_container() {
          // adds the container div to the widgets
    if ( function_exists('dynamic_sidebar') && is_sidebar_active('first-above-footer-aside') OR is_sidebar_active('second-above-footer-aside') OR is_sidebar_active('third-above-footer-aside') ) {
        //opens the container
        echo '<div id="thematic-above-footer">' . "\n" . '<div id="thematic-above-footer-asides">' . "\n";
        // calls the widgets
        above_footer_widgets ();
        //closes the container
        echo '</div><!-- thematic-above-footer-asides -->' . "\n" . '</div><!-- thematic-above-footer -->' . "\n"  ;
      }
    }
    add_action('thematic_abovefooter', 'above_footer_widgets_container',5);

    As for the filter thing, I'll better let Chris help you out. Tell me if this works and Chris, if you see any way to improve this code that would be welcome!!!!

    best,

    t.

    Posted 5 years ago #
  6. Don't get the current latest copy from the SVN repository!

    It has the thematic_footer() thing up and running but I still need to sort out a few things with the subsidiary widget area.

    Chris

    Posted 5 years ago #
  7. Btw.: I forgot to mention .. as soon as the widget area code is ready for the footer, moving the widget area is just changing the fields for the action hook ;)

    Posted 5 years ago #
  8. Justin
    Member

    Wow, thank you both!

    theorib, I had initially studied this or similar code you added in another post and was hoping to avoid adding a new widget area to the framework. However, at the end of the day my choice was between that and edits strait into the files to get the control I needed. I'm Looking forward to see what Chris has incorporated to grab more control of those subsidiary widgets.

    Chris, I will wait for you to give the go on subversion before digging in. Are their any big areas of concern with other changes that may be in lurking in the Subversion code base? I have to launch this week and may not have much time for debugging.

    Thanks again!!!

    Posted 5 years ago #
  9. My brain feels like the Gordian knot, but I think I got it.

    Let me do some tests before I release the latest changes to the SVN.

    Chris

    Posted 5 years ago #
  10. OK .. will do the test and move the widget area above the footer .. wish me luck! ;)

    Posted 5 years ago #
  11. Can you see me smile?

    It works!

    Still need to upload the changes to the SVN .. here's the code that moves the widget area:

    // Let's move the subsidiary widget area above the footer
    function move_subsidiaries($content) {
    	$content['1st Subsidiary Aside']['action_hook'] = 'thematic_abovefooter';
    	$content['2nd Subsidiary Aside']['action_hook'] = 'thematic_abovefooter';
    	$content['3rd Subsidiary Aside']['action_hook'] = 'thematic_abovefooter';
    	return $content;
    }
    add_filter('thematic_widgetized_areas', 'move_subsidiaries');
    
    // Now we need to unhook everything else that's related to the subsidiary widget area
    function remove_relatedfunctions() {
        remove_action('widget_area_subsidiaries', 'thematic_subsidiaryopen', 10);
        remove_action('widget_area_subsidiaries', 'add_before_first_sub',20);
        remove_action('widget_area_subsidiaries', 'add_between_firstsecond_sub',40);
        remove_action('widget_area_subsidiaries', 'add_between_secondthird_sub',60);
        remove_action('widget_area_subsidiaries', 'add_after_third_sub',80);
        remove_action('widget_area_subsidiaries', 'thematic_subsidiaryclose', 200);
    }
    add_action('init', 'remove_relatedfunctions');
    
    // And now we need to add these functions to thematic_abovefooter()
    add_action('thematic_abovefooter', 'thematic_subsidiaryopen', 10);
    add_action('thematic_abovefooter', 'add_before_first_sub',20);
    add_action('thematic_abovefooter', 'add_between_firstsecond_sub',40);
    add_action('thematic_abovefooter', 'add_between_secondthird_sub',60);
    add_action('thematic_abovefooter', 'add_after_third_sub',80);
    add_action('thematic_abovefooter', 'thematic_subsidiaryclose', 200);

    Chris

    Posted 5 years ago #
  12. Need a bit more time to hunt down a minor glitch the current widgets.php.

    Posted 5 years ago #
  13. Problem solved .. uploaded the latest changes to the SVN repository and to my blog.

    Blog is still up and running :)

    Chris

    Posted 5 years ago #
  14. Chris you are just awesome!!! :D

    Posted 5 years ago #
  15. softlimit
    Member

    Looking for a similar "above the footer" content area solution, but would love to keep the footer subsidiary widget areas intact. Any thoughts on that? The end goal is to get a series of category columns appearing down at the bottom of the homepage. Chances are, I'll do the category columns using an existing widget... Was wondering if the best solution might be to just do as above, but just moving the "index bottom" widget area above the footer rather than having it wrapped in the main content column. I'm sure I should be able to figure this out on my own, but... my PHP skills are a bit limited when it comes to writing custom functions, etc. Would appreciate any help. Thanks in advance!

    Posted 4 years ago #
  16. softlimit
    Member

    scratch that... just found this post http://forums.themeshaper.com/topic/how-to-add-widget-areas which seems to be a perfect solution.

    Posted 4 years ago #
  17. butters81
    Member

    Just in case anyone else is pulling their hair out, in the latest SVN (as on 5apr12), I've just realised that some of those hooks have been renamed for consistency. So will be "thematic_before_first_sub" rather than "add_before_first_sub"!

    Posted 2 years ago #
  18. good point @butters81 ! the renaming was part of passing WP theme review standards.

    Posted 2 years ago #
  19. shelleyeaster
    Member

    Hi @butters81, thanks for pointing that out. I've tried to fix the code to make it work with the latest SVN but I'm afraid I'm not figuring it out. Does anyone know how this code can be updated to work with the renamed hooks? Thanks in advance for help.

    Posted 2 years ago #
  20. This should work.

    // Let's move the subsidiary widget area above the footer
    function move_subsidiaries($content) {
        $content['1st Subsidiary Aside']['action_hook'] = 'thematic_abovefooter';
        $content['2nd Subsidiary Aside']['action_hook'] = 'thematic_abovefooter';
        $content['3rd Subsidiary Aside']['action_hook'] = 'thematic_abovefooter';
        return $content;
    }
    add_filter('thematic_widgetized_areas', 'move_subsidiaries');
    
    // Now we need to unhook everything else that's related to the subsidiary widget area
    function remove_relatedfunctions() {
        remove_action('widget_area_subsidiaries', 'thematic_subsidiaryopen', 10);
        remove_action('widget_area_subsidiaries', 'thematic_before_first_sub',20);
        remove_action('widget_area_subsidiaries', 'thematic_between_firstsecond_sub',40);
        remove_action('widget_area_subsidiaries', 'thematic_between_secondthird_sub',60);
        remove_action('widget_area_subsidiaries', 'thematic_after_third_sub',80);
        remove_action('widget_area_subsidiaries', 'thematic_subsidiaryclose', 200);
    }
    add_action('init', 'remove_relatedfunctions');
    
    // And now we need to add these functions to thematic_abovefooter()
        add_action('thematic_abovefooter', 'thematic_subsidiaryopen', 10);
        add_action('thematic_abovefooter', 'thematic_before_first_sub',20);
        add_action('thematic_abovefooter', 'thematic_between_firstsecond_sub',40);
        add_action('thematic_abovefooter', 'thematic_between_secondthird_sub',60);
        add_action('thematic_abovefooter', 'thematic_after_third_sub',80);
        add_action('thematic_abovefooter', 'thematic_subsidiaryclose', 200);
    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.