<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>ThemeShaper Forums Topic: how to add widget areas</title>
<link>http://themeshaper.com/forums/</link>
<description>Help In Shaping WordPress Themes</description>
<language>en</language>
<pubDate>Sun, 19 May 2013 17:53:14 +0000</pubDate>

<item>
<title>flick on "how to add widget areas"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-widget-areas#post-9684</link>
<pubDate>Thu, 11 Feb 2010 00:43:28 +0000</pubDate>
<dc:creator>flick</dc:creator>
<guid isPermaLink="false">9684@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;I'm sure this function has been introduced already, but unfortunately I'm being very blind here.&#60;/p&#62;
&#60;p&#62;Say for instance, if I wanted to add a 4th Subsidiary widget that spanned across the bottom of 1st and 2nd Subsidiary aside?&#60;/p&#62;
&#60;p&#62;Or would this be more of a css styling issue?&#60;/p&#62;
&#60;p&#62;Thanks. :)
&#60;/p&#62;</description>
</item>
<item>
<title>theorib on "how to add widget areas"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-widget-areas#post-6904</link>
<pubDate>Sat, 03 Oct 2009 15:34:05 +0000</pubDate>
<dc:creator>theorib</dc:creator>
<guid isPermaLink="false">6904@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Thanks for the advice Chris,&#60;/p&#62;
&#60;p&#62;For the record, I will display the functions I wrote in case anyone is looking for something similar. Here I'm creating 3 new widget areas, creating an action hook to put them inside the &#60;code&#62;thematic_abovefooter()&#60;/code&#62; and then actually putting them on the newly created action hook.&#60;/p&#62;
&#60;p&#62;If anyone has tips to improve that coding they are very welcome but this works otherwise and I can create new widget areas easily to put somewhere else...&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
// Register my widget Areas
function my_widgets_init() {
	if ( !function_exists(&#38;#39;register_sidebars&#38;#39;) )
		return;
	  // Register Widgetized areas.
			   // Area 1
            register_sidebar(array(
       	&#38;#39;name&#38;#39; =&#38;gt; &#38;#39;Above Footer Aside 1&#38;#39;,
       	&#38;#39;id&#38;#39; =&#38;gt; &#38;#39;above-footer-aside-1&#38;#39;,
       	&#38;#39;before_widget&#38;#39; =&#38;gt; &#38;#39;&#38;lt;li id=&#38;quot;%1$s&#38;quot; class=&#38;quot;widgetcontainer %2$s&#38;quot;&#38;gt;&#38;#39;,
       	&#38;#39;after_widget&#38;#39; =&#38;gt; &#38;#39;&#38;lt;/li&#38;gt;&#38;#39;,
		    &#38;#39;before_title&#38;#39; =&#38;gt; &#38;quot;&#38;lt;h3 class=\&#38;quot;widgettitle\&#38;quot;&#38;gt;&#38;quot;,
		    &#38;#39;after_title&#38;#39; =&#38;gt; &#38;quot;&#38;lt;/h3&#38;gt;\n&#38;quot;,
    ));
				// Area 2
            register_sidebar(array(
       	&#38;#39;name&#38;#39; =&#38;gt; &#38;#39;Above Footer Aside 2&#38;#39;,
       	&#38;#39;id&#38;#39; =&#38;gt; &#38;#39;above-footer-aside-2&#38;#39;,
       	&#38;#39;before_widget&#38;#39; =&#38;gt; &#38;#39;&#38;lt;li id=&#38;quot;%1$s&#38;quot; class=&#38;quot;widgetcontainer %2$s&#38;quot;&#38;gt;&#38;#39;,
       	&#38;#39;after_widget&#38;#39; =&#38;gt; &#38;#39;&#38;lt;/li&#38;gt;&#38;#39;,
		    &#38;#39;before_title&#38;#39; =&#38;gt; &#38;quot;&#38;lt;h3 class=\&#38;quot;widgettitle\&#38;quot;&#38;gt;&#38;quot;,
		    &#38;#39;after_title&#38;#39; =&#38;gt; &#38;quot;&#38;lt;/h3&#38;gt;\n&#38;quot;,
    ));
			  // Area 3
            register_sidebar(array(
       	&#38;#39;name&#38;#39; =&#38;gt; &#38;#39;Above Footer Aside 3&#38;#39;,
       	&#38;#39;id&#38;#39; =&#38;gt; &#38;#39;above-footer-aside-3&#38;#39;,
       	&#38;#39;before_widget&#38;#39; =&#38;gt; &#38;#39;&#38;lt;li id=&#38;quot;%1$s&#38;quot; class=&#38;quot;widgetcontainer %2$s&#38;quot;&#38;gt;&#38;#39;,
       	&#38;#39;after_widget&#38;#39; =&#38;gt; &#38;#39;&#38;lt;/li&#38;gt;&#38;#39;,
		    &#38;#39;before_title&#38;#39; =&#38;gt; &#38;quot;&#38;lt;h3 class=\&#38;quot;widgettitle\&#38;quot;&#38;gt;&#38;quot;,
		    &#38;#39;after_title&#38;#39; =&#38;gt; &#38;quot;&#38;lt;/h3&#38;gt;\n&#38;quot;,
    ));
}
add_action( &#38;#39;init&#38;#39;, &#38;#39;my_widgets_init&#38;#39; );

// Creates the Above footer Widgets Action Hook
function above_footer_widgets() {
    do_action(&#38;#39;above_footer_widgets&#38;#39;);
} // end thematic_abovefooter

// Creates the above footer widgets container
function above_footer_widgets_container() {
      // adds the container div to the widgets
if ( function_exists(&#38;#39;dynamic_sidebar&#38;#39;) &#38;#38;&#38;#38; is_sidebar_active(&#38;#39;above-footer-aside-1&#38;#39;) OR is_sidebar_active(&#38;#39;above-footer-aside-2&#38;#39;) OR is_sidebar_active(&#38;#39;above-footer-aside-3&#38;#39;) ) {
    //opens the container
    echo &#38;#39;&#38;lt;div id=&#38;quot;thematic-above-footer&#38;quot;&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot; . &#38;#39;&#38;lt;div id=&#38;quot;thematic-above-footer-widgets&#38;quot;&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot;;
    // calls the widgets
    above_footer_widgets ();
    //closes the container
    echo &#38;#39;&#38;lt;/div&#38;gt;&#38;lt;!-- thematic-above-footer-widgets --&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot; . &#38;#39;&#38;lt;/div&#38;gt;&#38;lt;!-- thematic-above-footer --&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot;  ;
}
}
add_action(&#38;#39;thematic_abovefooter&#38;#39;, &#38;#39;above_footer_widgets_container&#38;#39;);

// adds  widget areas to the thematic_abovefooter hook
function insert_above_footer_widgets() {
      // Area 1
if ( function_exists(&#38;#39;dynamic_sidebar&#38;#39;) &#38;#38;&#38;#38; is_sidebar_active(&#38;#39;above-footer-aside-1&#38;#39;) ) {
    echo &#38;#39;&#38;lt;div id=&#38;quot;above-footer-aside-1&#38;quot; class=&#38;quot;aside&#38;quot;&#38;gt;&#38;#39;. &#38;quot;\n&#38;quot; . &#38;#39;&#38;lt;ul class=&#38;quot;xoxo&#38;quot;&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot;;
    dynamic_sidebar(&#38;#39;above-footer-aside-1&#38;#39;);
    echo &#38;quot;\n&#38;quot; . &#38;#39;&#38;lt;/ul&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot; . &#38;#39;&#38;lt;/div&#38;gt;&#38;lt;!-- #above-footer-aside-1 .aside --&#38;gt;&#38;#39;. &#38;quot;\n&#38;quot;;
}
      // Area 2
if ( function_exists(&#38;#39;dynamic_sidebar&#38;#39;) &#38;#38;&#38;#38; is_sidebar_active(&#38;#39;above-footer-aside-2&#38;#39;) ) {
    echo &#38;#39;&#38;lt;div id=&#38;quot;above-footer-aside-2&#38;quot; class=&#38;quot;aside&#38;quot;&#38;gt;&#38;#39;. &#38;quot;\n&#38;quot; . &#38;#39;&#38;lt;ul class=&#38;quot;xoxo&#38;quot;&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot;;
    dynamic_sidebar(&#38;#39;above-footer-aside-2&#38;#39;);
    echo &#38;quot;\n&#38;quot; . &#38;#39;&#38;lt;/ul&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot; . &#38;#39;&#38;lt;/div&#38;gt;&#38;lt;!-- #above-footer-aside-2 .aside --&#38;gt;&#38;#39;. &#38;quot;\n&#38;quot;;
}
      // Area 3
if ( function_exists(&#38;#39;dynamic_sidebar&#38;#39;) &#38;#38;&#38;#38; is_sidebar_active(&#38;#39;above-footer-aside-3&#38;#39;) ) {
    echo &#38;#39;&#38;lt;div id=&#38;quot;above-footer-aside-3&#38;quot; class=&#38;quot;aside&#38;quot;&#38;gt;&#38;#39;. &#38;quot;\n&#38;quot; . &#38;#39;&#38;lt;ul class=&#38;quot;xoxo&#38;quot;&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot;;
    dynamic_sidebar(&#38;#39;above-footer-aside-3&#38;#39;);
    echo &#38;quot;\n&#38;quot; . &#38;#39;&#38;lt;/ul&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot; . &#38;#39;&#38;lt;/div&#38;gt;&#38;lt;!-- #above-footer-aside-3 .aside --&#38;gt;&#38;#39;. &#38;quot;\n&#38;quot;;
}
}
add_action(&#38;#39;above_footer_widgets&#38;#39;, &#38;#39;insert_above_footer_widgets&#38;#39;);
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>Chris on "how to add widget areas"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-widget-areas#post-6892</link>
<pubDate>Fri, 02 Oct 2009 19:11:37 +0000</pubDate>
<dc:creator>Chris</dc:creator>
<guid isPermaLink="false">6892@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hi Theo,&#60;/p&#62;
&#60;p&#62;:) .. and a good one!&#60;/p&#62;
&#60;p&#62;No .. my_windets_init() would contain 3 x the register_sidebar() function (one for each widgetized area) and you would do the same with above_footer_widgets(). This function would contain 3 x the current content (again one for each widgetized area). &#60;/p&#62;
&#60;p&#62;Chris
&#60;/p&#62;</description>
</item>
<item>
<title>theorib on "how to add widget areas"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-widget-areas#post-6869</link>
<pubDate>Thu, 01 Oct 2009 23:09:29 +0000</pubDate>
<dc:creator>theorib</dc:creator>
<guid isPermaLink="false">6869@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Chris, I don't want to bother by asking so much =) but though I'm studying some PHP it's a whole new universe for me (I'm a photographer).&#60;/p&#62;
&#60;p&#62;I decided I need 3 widget areas on the &#60;code&#62;thematic_abovefooter()&#60;/code&#62; and I read the function you proposed but couldn't really figure out how to do it. I could of course repeat the function I wrote 3 times to get 3 areas but that is probably overkill.&#60;/p&#62;
&#60;p&#62;I might use some help...
&#60;/p&#62;</description>
</item>
<item>
<title>Chris on "how to add widget areas"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-widget-areas#post-6867</link>
<pubDate>Thu, 01 Oct 2009 20:46:18 +0000</pubDate>
<dc:creator>Chris</dc:creator>
<guid isPermaLink="false">6867@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Will do that .. and there will be something new latest 'til end of this year :)
&#60;/p&#62;</description>
</item>
<item>
<title>theorib on "how to add widget areas"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-widget-areas#post-6866</link>
<pubDate>Thu, 01 Oct 2009 20:35:14 +0000</pubDate>
<dc:creator>theorib</dc:creator>
<guid isPermaLink="false">6866@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;That looks great!&#60;/p&#62;
&#60;p&#62;The one I wrote above is working nice for above the footer though, I'm thinking if I want 1 widget aside area or 3 above the footer...&#60;/p&#62;
&#60;p&#62;Thank you so much again Chris. Thematic is awesome and the support you provide is unsurpassed! If you happen to refine the function it would be nice to have it on you code snippets page!
&#60;/p&#62;</description>
</item>
<item>
<title>Chris on "how to add widget areas"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-widget-areas#post-6864</link>
<pubDate>Thu, 01 Oct 2009 15:50:22 +0000</pubDate>
<dc:creator>Chris</dc:creator>
<guid isPermaLink="false">6864@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hi Theo,&#60;/p&#62;
&#60;p&#62;tried this a while ago. I created a one-line version which was able to handle only one widgetized area inside of an action hook. As soon as you want to implement a second or third widgetized area you need to write an additional function. So I dropped this code.&#60;/p&#62;
&#60;p&#62;I'm working on a new code that makes it easier to create a real flexible widgetized area. It won't be a one-line solution. The code is similar to the one above.&#60;/p&#62;
&#60;p&#62;This is an example for creating an additional special Secondary Aside that will dispay on pages:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function change_secondary_aside($content) {
        // change the standard function for Secondary Aside to our new one
	$content[&#38;#39;Secondary Aside&#38;#39;][&#38;#39;function&#38;#39;] = &#38;#39;childtheme_secondary_aside&#38;#39;;
        // create the new widgetized area
	$content[&#38;#39;Secondary Aside Pages&#38;#39;] = array(
                // this is used to sort the list of widgetized areas in wp-admin
		&#38;#39;admin_menu_order&#38;#39; =&#38;gt; 201,
                // defines our needed arguments .. btw. you can filter the markup
		&#38;#39;args&#38;#39; =&#38;gt; array (
			&#38;#39;name&#38;#39; =&#38;gt; &#38;#39;Secondary Aside Pages&#38;#39;,
			&#38;#39;id&#38;#39; =&#38;gt; &#38;#39;secondary-aside-pages&#38;#39;,
			&#38;#39;before_widget&#38;#39; =&#38;gt; thematic_before_widget(),
			&#38;#39;after_widget&#38;#39; =&#38;gt; thematic_after_widget(),
			&#38;#39;before_title&#38;#39; =&#38;gt; thematic_before_title(),
			&#38;#39;after_title&#38;#39; =&#38;gt; thematic_after_title(),
		),
                // that&#38;#39;s the action hook where we integrate the widgetized area
		&#38;#39;action_hook&#38;#39;	=&#38;gt; &#38;#39;thematic_secondary_aside&#38;#39;,
                // the function that defines the wigetized area
		&#38;#39;function&#38;#39;		=&#38;gt; &#38;#39;childtheme_secondary_aside&#38;#39;,
                // ... and the priority of this function
		&#38;#39;priority&#38;#39;		=&#38;gt; 10,
	);

	return $content;
}
add_filter(&#38;#39;thematic_widgetized_areas&#38;#39;,&#38;#39;change_secondary_aside&#38;#39;);

function childtheme_secondary_aside() {
        // we start to display if both areas have widgets
	if (is_sidebar_active(&#38;#39;secondary-aside&#38;#39;) &#38;#38;&#38;#38; is_sidebar_active(&#38;#39;secondary-aside-pages&#38;#39;)) {
		echo thematic_before_widget_area(&#38;#39;secondary-aside&#38;#39;);
		if (is_page()) {
                        // this is a page and we dispay our special Secondary Aside
			dynamic_sidebar(&#38;#39;secondary-aside-pages&#38;#39;);
		} else {
                        // this isn&#38;#39;t a page and we display our regular Secondary Aside
			dynamic_sidebar(&#38;#39;secondary-aside&#38;#39;);
		}
		echo thematic_after_widget_area(&#38;#39;secondary-aside&#38;#39;);
	}
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Need to do some minor changes / additions:&#60;br /&#62;
- embed the sort into a filter function, just in case that someone wants to change it to anything else&#60;br /&#62;
- change the sidebar code for the footer&#60;br /&#62;
- a bit house keeping&#60;/p&#62;
&#60;p&#62;Chris
&#60;/p&#62;</description>
</item>
<item>
<title>theorib on "how to add widget areas"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-widget-areas#post-6858</link>
<pubDate>Thu, 01 Oct 2009 13:31:23 +0000</pubDate>
<dc:creator>theorib</dc:creator>
<guid isPermaLink="false">6858@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;I came up with one of your posts and wrote this:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;// This will create your widget area
function my_widgets_init() {
    register_sidebar(array(
       	&#38;#39;name&#38;#39; =&#38;gt; &#38;#39;Above Footer Aside&#38;#39;,
       	&#38;#39;id&#38;#39; =&#38;gt; &#38;#39;above-footer-aside&#38;#39;,
       	&#38;#39;before_widget&#38;#39; =&#38;gt; &#38;#39;&#38;lt;li id=&#38;quot;%1$s&#38;quot; class=&#38;quot;widgetcontainer %2$s&#38;quot;&#38;gt;&#38;#39;,
       	&#38;#39;after_widget&#38;#39; =&#38;gt; &#38;#39;&#38;lt;/li&#38;gt;&#38;#39;,
		&#38;#39;before_title&#38;#39; =&#38;gt; &#38;quot;&#38;lt;h3 class=\&#38;quot;widgettitle\&#38;quot;&#38;gt;&#38;quot;,
		&#38;#39;after_title&#38;#39; =&#38;gt; &#38;quot;&#38;lt;/h3&#38;gt;\n&#38;quot;,
    ));

}
add_action( &#38;#39;init&#38;#39;, &#38;#39;my_widgets_init&#38;#39; );

// adding the widget area to your child theme
function above_footer_widgets() {
if ( function_exists(&#38;#39;dynamic_sidebar&#38;#39;) &#38;#38;&#38;#38; is_sidebar_active(&#38;#39;above-footer-aside&#38;#39;) ) {
    echo &#38;#39;&#38;lt;div id=&#38;quot;above-footer-aside&#38;quot; class=&#38;quot;aside&#38;quot;&#38;gt;&#38;#39;. &#38;quot;\n&#38;quot; . &#38;#39;&#38;lt;ul class=&#38;quot;xoxo&#38;quot;&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot;;
    dynamic_sidebar(&#38;#39;above-footer-aside&#38;#39;);
    echo &#38;#39;&#38;lt;/ul&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot; . &#38;#39;&#38;lt;/div&#38;gt;&#38;lt;!-- #above-footer-aside .aside --&#38;gt;&#38;#39;. &#38;quot;\n&#38;quot;;
}
}
add_action(&#38;#39;thematic_abovefooter&#38;#39;, &#38;#39;above_footer_widgets&#38;#39;, 8);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Is this the best way to go or is there really a one line function =)&#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
</item>
<item>
<title>theorib on "how to add widget areas"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-widget-areas#post-6857</link>
<pubDate>Thu, 01 Oct 2009 13:15:01 +0000</pubDate>
<dc:creator>theorib</dc:creator>
<guid isPermaLink="false">6857@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Chris, did you ever come out with that one-line-function to add widget areas?&#60;/p&#62;
&#60;p&#62;I want to add a widgetizable area on the thematic_abovefooter() hook...&#60;/p&#62;
&#60;p&#62;Thanks in advanced!&#60;/p&#62;
&#60;p&#62;Theo
&#60;/p&#62;</description>
</item>
<item>
<title>Chris on "how to add widget areas"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-widget-areas#post-5532</link>
<pubDate>Mon, 03 Aug 2009 19:48:50 +0000</pubDate>
<dc:creator>Chris</dc:creator>
<guid isPermaLink="false">5532@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;if you could wait until Friday .. I'm working on a functionality that enables you to create a widget area with a single line :)&#60;/p&#62;
&#60;p&#62;It's already working on my local machine for the regular sidebar. I need to rewrite Thematic to use this code for all other widget areas, add some more bells &#38;#38; whistles, do some testing and write a tiny bit of documentation for it.&#60;/p&#62;
&#60;p&#62;Chris
&#60;/p&#62;</description>
</item>
<item>
<title>amygail on "how to add widget areas"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-widget-areas#post-5528</link>
<pubDate>Mon, 03 Aug 2009 16:20:26 +0000</pubDate>
<dc:creator>amygail</dc:creator>
<guid isPermaLink="false">5528@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;This should help&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://themeshaper.com/forums/topic/widgets-in-the-header&#34; rel=&#34;nofollow&#34;&#62;http://themeshaper.com/forums/topic/widgets-in-the-header&#60;/a&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>blackinches on "how to add widget areas"</title>
<link>http://themeshaper.com/forums/topic/how-to-add-widget-areas#post-5514</link>
<pubDate>Sun, 02 Aug 2009 21:32:44 +0000</pubDate>
<dc:creator>blackinches</dc:creator>
<guid isPermaLink="false">5514@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;how do i add another widget area?  basically another area like the primary or secondary widget area.
&#60;/p&#62;</description>
</item>

</channel>
</rss>
