<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>iamtgc &#187; Wordpress</title>
	<atom:link href="http://iamtgc.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://iamtgc.com</link>
	<description></description>
	<lastBuildDate>Thu, 01 Mar 2012 19:46:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Implementing a Lightbox in WordPresss</title>
		<link>http://iamtgc.com/2012/03/01/implementing-a-lightbox-in-wordpresss/</link>
		<comments>http://iamtgc.com/2012/03/01/implementing-a-lightbox-in-wordpresss/#comments</comments>
		<pubDate>Thu, 01 Mar 2012 16:29:46 +0000</pubDate>
		<dc:creator>tgc</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://iamtgc.com/?p=731</guid>
		<description><![CDATA[The problem that I have encountered while researching various options for implementing a JavaScript lightbox in WordPress, is that they generally require you to add either a class, id, or rel attribute to your image link. This may not be &#8230; <a href="http://iamtgc.com/2012/03/01/implementing-a-lightbox-in-wordpresss/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The problem that I have encountered while researching various options for implementing a JavaScript lightbox in WordPress, is that they generally require you to add either a class, id, or rel attribute to your image link. This may not be an issue for newly authored content, but for those of us with a large volume of existing content, it can be a nightmare.</p>
<p>One solution proposed on <a title="Fancybox - Fancy jQuery lightbox alternative| Tips &amp; Tricks" href="http://fancybox.net/blog" target="_blank">Fancybox&#8217;s Tips &amp; Tricks</a> page, is to apply the lightbox only to those &lt;a&gt; tags whose href attribute ends with .jpg, .png or .gif:</p>
<pre class="brush:js;">$("a[href$=.jpg],a[href$=.png],a[href$=.gif]").fancybox();</pre>
<p>This may work for many situations, but it could have unintended consequences depending on your content, so I chose a different approach.<br />
<span id="more-731"></span><br />
The lightbox I ended up going with is <a title="ColorBox, A jQuery Lightbox" href="http://jacklmoore.com/colorbox/" target="_blank">Colorbox</a>, but <a title="30 Efficient jQuery Lightbox Plugins" href="http://www.designyourway.net/blog/resources/30-efficient-jquery-lightbox-plugins/" target="_blank">many others</a> exist, and this article should apply to a majority of them with minimal modification.</p>
<p>If you&#8217;ve read any of my <a title="Add Google +1 to your WordPress blog" href="http://iamtgc.com/2011/07/13/add-google-plus-one-to-your-wordpress-blog/">other</a> <a title="Integrating a Google Custom Search Engine into your WordPress blog" href="http://iamtgc.com/2011/07/10/integrating-a-google-custom-search-engine-into-your-wordpress-blog/">articles</a> you know I usually prefer to avoid using plugins, especially for these simple tasks.</p>
<p>Once you&#8217;ve <a href="http://jacklmoore.com/colorbox/colorbox.zip" title="ColorBox, A jQuery Lightbox">downloaded</a> the lightbox of your choice, choose a location to place the javascript and accompanying stylesheet, in this example I&#8217;ve placed both in <strong>/js</strong>. Then place the following in <strong>functions.php</strong>. This example uses a <a href="http://codex.wordpress.org/Child_Themes" title="Child Themes &laquo; WordPress Codex" target="_blank">child theme</a>, if you&#8217;re not, you should replace <a href="http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri" title="Function Reference/get stylesheet directory uri &laquo; WordPress Codex" target="_blank">get_stylesheet_directory_uri()</a> with <a href="http://codex.wordpress.org/Function_Reference/get_template_directory_uri" title="Function Reference/get template directory uri &laquo; WordPress Codex" target="_blank">get_template_directory_uri()</a>.</p>
<pre class="brush:php;">function tgc_scripts_method() {
    wp_register_script( 'jquery.colorbox',
                        get_stylesheet_directory_uri() . '/js/jquery.colorbox-min.js',
                        array( 'jquery' ) );
    wp_enqueue_script( 'jquery.colorbox' );
}

add_action( 'wp_enqueue_scripts', 'tgc_scripts_method' );
</pre>
<p>Next you&#8217;ll need to add the relevant css and javascript to <strong>header.php</strong>, as in functions.php above, this assumes a child theme. If you&#8217;re using a parent theme, replace the <em>stylesheet_directory</em> parameter with <em>template_directory</em> in the <a href="http://codex.wordpress.org/Function_Reference/bloginfo" title="Function Reference/bloginfo &laquo; WordPress Codex" target="_blank">bloginfo</a> function.</p>
<pre class="brush:html;">
&lt;link rel="stylesheet" type="text/css" media="all" href="&lt;?php bloginfo( 'stylesheet_directory' ); ?&gt;/js/colorbox.css" /&gt;
&lt;script&gt;
    jQuery(document).ready(function () {
        jQuery('a[rel="colorbox"]').colorbox({ rel:"nofollow" });
    });
&lt;/script&gt;
</pre>
<p>Last, we need to modify our &lt;a&gt; tags to include a <em>rel</em> attribute with the value of <em>colorbox</em>. We do this by adding a <a href="http://codex.wordpress.org/Function_Reference/add_filter" title="Function Reference/add filter &laquo; WordPress Codex" target="_blank">filter</a> to <a href="http://codex.wordpress.org/Function_Reference/the_content" title="Function Reference/the content &laquo; WordPress Codex" target="_blank">the_content</a>. This avoids having to update each post or modify the database. Additionally, if we change our mind on which lightbox we want to use, or how we&#8217;re invoking it, the modifications will be a lot simpler.</p>
<p>The regular expression we will use targets &lt;a&gt; tags which link to an image (.jpg, .png, or .gif) and where the link text is an &lt;img&gt; tag of the same image. For example:</p>
<pre class="brush:html;">
&lt;a href="image.jpg"&gt;&lt;img src="image-1024x701.jpg"/&gt;&lt;/a&gt;
</pre>
<p>Here is what you&#8217;ll need to add to <strong>functions.php</strong></p>
<pre class="brush:php;">
function tgc_colorbox_content_filter( $content ) {
        $url_regex = '/(&lt;a .*href="(.*)\.(jpg|png|gif)")(.*&gt;&lt;img .*src="\2.*\.\3".*&gt;&lt;\/a&gt;)/i';
        $url_replace = '$1 rel="colorbox" $4';

        return preg_replace( $url_regex, $url_replace, $content );
}

add_filter( 'the_content', 'tgc_colorbox_content_filter' );
</pre>
]]></content:encoded>
			<wfw:commentRss>http://iamtgc.com/2012/03/01/implementing-a-lightbox-in-wordpresss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Move the Navigation Bar in a Twentyeleven Child Theme</title>
		<link>http://iamtgc.com/2012/02/16/move-the-navigation-bar-in-a-twentyeleven-child-theme/</link>
		<comments>http://iamtgc.com/2012/02/16/move-the-navigation-bar-in-a-twentyeleven-child-theme/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 02:58:33 +0000</pubDate>
		<dc:creator>tgc</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://iamtgc.com/?p=705</guid>
		<description><![CDATA[If you don&#8217;t like the default location of twentyeleven&#8217;s navigation bar, there&#8217;s good news, the theme is coded in such a way where it&#8217;s very simple to move with just a few lines of CSS. As I&#8217;ve mentioned in previous &#8230; <a href="http://iamtgc.com/2012/02/16/move-the-navigation-bar-in-a-twentyeleven-child-theme/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you don&#8217;t like the default location of <a href="http://wordpress.org/extend/themes/twentyeleven" title="Twenty Eleven Theme">twentyeleven&#8217;s</a> navigation bar, there&#8217;s good news, the theme is coded in such a way where it&#8217;s very simple to move with just a few lines of CSS.</p>
<p>As I&#8217;ve mentioned in <a href="http://iamtgc.com/2011/07/15/adding-the-sidebar-to-a-twentyeleven-child-theme/" title="Adding the sidebar to a Twentyeleven child theme" target="_blank">previous</a> <a href="http://iamtgc.com/2011/08/12/remove-default-header-images-from-twentyeleven-child-theme/" title="Remove the default header images from a Twentyeleven child theme" target="_blank">articles</a>, you&#8217;re strongly encouraged to tackle this using <a href="http://codex.wordpress.org/Child_Themes" title="Child Themes" target="_blank">child themes</a>.</p>
<p>First we begin by inspecting the current theme with <a href="http://getfirebug.com/" title="Firebug">Firebug</a>. Since the navigation bar is the element we&#8217;re interested in, that&#8217;s the one we&#8217;ll inspect with Firebug. We&#8217;re interested in the layout as seen in the image below.<br />
<span id="more-705"></span><br />
<a href="http://iamtgc.com/wp-content/uploads/2012/02/twentyeleven-firebug.jpg" rel="colorbox" ><img src="http://iamtgc.com/wp-content/uploads/2012/02/twentyeleven-firebug-1024x701.jpg" alt="" title="twentyeleven-firebug" width="640" height="438" class="aligncenter size-large wp-image-717" /></a></p>
<p>As it turns out, the height of the navigation bar is 43px, that gives us all the information we really need to know to move the navigation bar.</p>
<p>Here&#8217;s what our child theme&#8217;s <strong>style.css</strong> looks like.</p>
<pre class="brush:css;">
/*
Theme Name: iamtgc Theme Development
Description: Child theme for the Twenty Eleven theme
Author: tgc
Template: twentyeleven
*/

@import url("../twentyeleven/style.css");

#branding { padding-top: 43px; }

#branding #searchform { padding-top: 43px; }

#access { position: absolute; top: 0; }
</pre>
<p>And here&#8217;s what our new theme looks like once it&#8217;s activated. </p>
<p><a href="http://iamtgc.com/wp-content/uploads/2012/02/twentyeleven-navbar-top.jpg" rel="colorbox" ><img src="http://iamtgc.com/wp-content/uploads/2012/02/twentyeleven-navbar-top-1024x520.jpg" alt="" title="twentyeleven-navbar-top" width="640" height="325" class="aligncenter size-large wp-image-707" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://iamtgc.com/2012/02/16/move-the-navigation-bar-in-a-twentyeleven-child-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Pinterest&#8217;s &#8220;Pin It&#8221; Button To Your WordPress Blog</title>
		<link>http://iamtgc.com/2012/02/01/add-pinterests-pin-it-button-to-your-wordpress-blog/</link>
		<comments>http://iamtgc.com/2012/02/01/add-pinterests-pin-it-button-to-your-wordpress-blog/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 00:15:10 +0000</pubDate>
		<dc:creator>tgc</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://iamtgc.com/?p=666</guid>
		<description><![CDATA[Even if you haven&#8217;t been fortunate enough to receive a Pinterest invite yet, chances are you&#8217;ve seen their &#8220;Pin It&#8221; button somewhere in your daily browsing. Fortunately you don&#8217;t need an invitation to add the &#8220;Pin It&#8221; button to your &#8230; <a href="http://iamtgc.com/2012/02/01/add-pinterests-pin-it-button-to-your-wordpress-blog/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Even if you haven&#8217;t been fortunate enough to receive a <a href="http://pinterest.com" title="Pinterest">Pinterest</a> invite yet, chances are you&#8217;ve seen their &#8220;Pin It&#8221; button somewhere in your daily browsing.  Fortunately you don&#8217;t need an invitation to add the &#8220;Pin It&#8221; button to your website.  In this article I will show you how to add the &#8220;Pin It&#8221; button to your WordPress blog.<br />
<span id="more-666"></span><br />
To get an understanding of the API, you can visit Pinterest&#8217;s <a href="http://pinterest.com/about/goodies/" title="Pinterest / Goodies" target="_blank">Goodies</a> page, and scroll down to the section labeled <strong>&#8220;Pin It&#8221; Button For Websites</strong>.  There you&#8217;ll see the following code generator.</p>
<p><a href="http://iamtgc.com/wp-content/uploads/2012/01/pinterest-form.jpg" rel="colorbox" ><img src="http://iamtgc.com/wp-content/uploads/2012/01/pinterest-form.jpg" alt="" title="Pinterest Form" width="630" height="456" class="aligncenter size-full wp-image-677" /></a></p>
<p>Once you begin populating the fields, your changes are reflected in the code window.  As you may notice, the URLs you&#8217;re Pinning will need to be <a href="http://en.wikipedia.org/wiki/Percent-encoding" title="Percent-encoding - Wikipedia, the free encyclopedia" target="_blank">URL encoded</a>.</p>
<p><a href="http://iamtgc.com/wp-content/uploads/2012/01/pinterest-form-partial1.jpg" rel="colorbox" ><img src="http://iamtgc.com/wp-content/uploads/2012/01/pinterest-form-partial1.jpg" alt="" title="Partially Populated Pinterest Form" width="625" height="449" class="aligncenter size-full wp-image-686" /></a></p>
<p>In order to implement this code generation in WordPress, we&#8217;ll get the <strong>URL of the webpage the pin is on</strong> using</p>
<pre class="brush:php;">
&lt;?php echo urlencode( get_permalink() ); ?&gt;
</pre>
<p>The <strong>URL of the image to be pinned</strong> using the post&#8217;s full sized featured image.</p>
<pre class="brush:php;">
&lt;?php echo urlencode( wp_get_attachment_url( get_post_thumbnail_id() ) ); ?&gt;
</pre>
<p>And for the <em>optional</em> <strong>Description of the Pin</strong>, we&#8217;ll use the post&#8217;s title</p>
<pre class="brush:php;">
&lt;?php echo urlencode( get_the_title() ); ?&gt;
</pre>
<p>When we put it all together, here&#8217;s what the relevant excerpt of our <strong>loop-single.php</strong> will look like. If you want to include the Pin Count along with the &#8220;Pin It&#8221; button, you can change the <strong>count-layout</strong> attribute to either <strong>horizontal</strong> or <strong>vertical</strong>.</p>
<pre class="brush:html;">
&lt;div id="post-&lt;?php the_ID(); ?&gt;" &lt;?php post_class(); ?&gt;&gt;
&lt;h1 class="entry-title"&gt;&lt;?php the_title(); ?&gt;
     &lt;a href="http://pinterest.com/pin/create/button/?url=&lt;?php echo urlencode(get_permalink()); ?&gt;&#038;media=&lt;?php echo urlencode(wp_get_attachment_url(get_post_thumbnail_id())); ?&gt;&#038;description=&lt;?php echo urlencode( get_the_title()); ?&gt;" class="pin-it-button" count-layout="none"&gt;Pin It&lt;/a&gt;
     &lt;script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"&gt;&lt;/script&gt;
&lt;/h1&gt;

&lt;div class="entry-meta"&gt;
&lt;?php twentyten_posted_on(); ?&gt;
&lt;/div&gt;&lt;!-- .entry-meta --&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://iamtgc.com/2012/02/01/add-pinterests-pin-it-button-to-your-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Remove the default header images from a Twentyeleven child theme</title>
		<link>http://iamtgc.com/2011/08/12/remove-default-header-images-from-twentyeleven-child-theme/</link>
		<comments>http://iamtgc.com/2011/08/12/remove-default-header-images-from-twentyeleven-child-theme/#comments</comments>
		<pubDate>Sat, 13 Aug 2011 03:36:03 +0000</pubDate>
		<dc:creator>tgc</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://iamtgc.com/?p=485</guid>
		<description><![CDATA[Recently we looked at adding a sidebar to twentyeleven via a child theme. While adding functionality is likely where you will start in your theme customization, there will likely come a point that you will want to remove some specific &#8230; <a href="http://iamtgc.com/2011/08/12/remove-default-header-images-from-twentyeleven-child-theme/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently we looked at <a href="http://iamtgc.com/2011/07/15/adding-the-sidebar-to-a-twentyeleven-child-theme/" title="Adding the sidebar to a Twentyeleven child theme">adding a sidebar to twentyeleven via a child theme</a>.  While adding functionality is likely where you will start in your theme customization, there will likely come a point that you will want to remove some specific functionality as well.  </p>
<p>One of the most eye catching features of twentyeleven are it&#8217;s header images, but if you really want to make the theme your own, you may want to remove the stock header images in favor of your own.  Today we will do just that as we continue to explore customizing twentyeleven via a child theme.<br />
<span id="more-485"></span><br />
First, let&#8217;s see how twentyeleven loads it&#8217;s header images.  Here is a portion of twentyeleven&#8217;s <strong>functions.php</strong>, abbreviated for brevity.</p>
<pre class="brush:php;">
add_action( 'after_setup_theme', 'twentyeleven_setup' );

if ( ! function_exists( 'twentyeleven_setup' ) ):
...
function twentyeleven_setup() {
...
    register_default_headers( array(
        'wheel' => array(
            'url' => '%s/images/headers/wheel.jpg',
            'thumbnail_url' => '%s/images/headers/wheel-thumbnail.jpg',
            /* translators: header image description */
            'description' => __( 'Wheel', 'twentyeleven' )
        ),
...
    ) );
}
endif; // twentyeleven_setup
</pre>
<p>By looking at this, we know the headers are loaded with <a href="http://codex.wordpress.org/Function_Reference/register_default_headers" title="Function Reference/register default headers &laquo; WordPress Codex" target="_blank">register_default_headers</a>, in the twentyeleven_setup function, which is had been added to the after_theme_setup hook via <a href="http://codex.wordpress.org/Function_Reference/add_action" title="Function Reference/add action &laquo; WordPress Codex" target="_blank">add_action</a>.</p>
<p>Since the twentyeleven_setup() function has other goodies we want to keep, rather than rewrite the entire function, we create our own function to <a href="http://codex.wordpress.org/Function_Reference/unregister_default_headers" title="Function Reference/unregister default headers &laquo; WordPress Codex" target="_blank">unregister_default_headers</a>, and add it to the same after_theme_setup hook with a higher priority (the default is 10) so it will run after than the parent function.</p>
<p>Here we edit (or create) our child theme&#8217;s <strong>functions.php</strong></p>
<pre class="brush:php;">
&lt;?php
function remove_default_headers() {
        unregister_default_headers(
                array(
                        'wheel',
                        'shore',
                        'trolley',
                        'pine-cone',
                        'chessboard',
                        'lanterns',
                        'willow',
                        'hanoi'
                )
        );
}

add_action( 'after_setup_theme', 'remove_default_headers', 11 );
?&gt;
</pre>
<p><strong>Note: </strong> If you are uncertain of which action is best to hook into, you should refer to the <a href="http://codex.wordpress.org/Plugin_API/Action_Reference" title="Plugin API/Action Reference &laquo; WordPress Codex" target="_blank">Plugin API/Action Reference</a> at the <a href="http://codex.wordpress.org/" title="Wordpress Codex" target="_blank">WordPress Codex</a>.</p>
<p>Now, when you browse the header section in the dashboard, you should be greeted with the following<br />
<a href="http://iamtgc.com/wp-content/uploads/2011/08/child-twentyeleven-no-headers.jpg" rel="colorbox" ><img src="http://iamtgc.com/wp-content/uploads/2011/08/child-twentyeleven-no-headers-1024x458.jpg" alt="" title="child-twentyeleven-no-headers" width="640" height="286" class="aligncenter size-large wp-image-520" /></a></p>
<p>Now that all of the default headers are gone, we can edit our child theme&#8217;s <strong>functions.php</strong> to add our own header.  In this example, we&#8217;ve copied our header and a thumbnail, into images/headers under the child theme&#8217;s directory.<br />
i.e.<br />
<strong>twentyeleven-child/images/headers/header.jpg</strong><br />
and<br />
<strong>twentyeleven-child/images/headers/header-thumbnail.jpg</strong></p>
<pre class="brush:php;">
&lt;?php
function remove_default_headers() {
    unregister_default_headers(
        array(
            'wheel',
            'shore',
            'trolley',
            'pine-cone',
            'chessboard',
            'lanterns',
            'willow',
            'hanoi'
        )
    );
    register_default_headers( array(
        'tgcheader' => array(
            'url' => get_stylesheet_directory_uri() . '/images/headers/header.jpg',
            'thumbnail_url' => get_stylesheet_directory_uri() . '/images/headers/header-thumbnail.jpg',
            /* translators: header image description */
            'description' => __( 'tgcheader', 'twentyeleven-child' )
        )
    ) );
}

add_action( 'after_setup_theme', 'remove_default_headers', 11 );
?&gt;
</pre>
<p>You should also note how we&#8217;re using <a href="http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri" title="Function Reference/get stylesheet directory uri &laquo; WordPress Codex" target="_blank">get_stylesheet_directory_uri()</a> to refer to our child theme&#8217;s path, instead of <strong>%s</strong>, which would reference the parent theme&#8217;s path.</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtgc.com/2011/08/12/remove-default-header-images-from-twentyeleven-child-theme/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding the sidebar to a Twentyeleven child theme</title>
		<link>http://iamtgc.com/2011/07/15/adding-the-sidebar-to-a-twentyeleven-child-theme/</link>
		<comments>http://iamtgc.com/2011/07/15/adding-the-sidebar-to-a-twentyeleven-child-theme/#comments</comments>
		<pubDate>Sat, 16 Jul 2011 00:48:04 +0000</pubDate>
		<dc:creator>tgc</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://iamtgc.com/?p=371</guid>
		<description><![CDATA[Twentyeleven offers a lot of cool features, one of my favorites is the Showcase template. However one of the downsides in my opinion (and probably yours, if you&#8217;ve found this article) is lack of a sidebar on your single posts &#8230; <a href="http://iamtgc.com/2011/07/15/adding-the-sidebar-to-a-twentyeleven-child-theme/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Twentyeleven offers a lot of cool features, one of my favorites is the Showcase template.  However one of the downsides in my opinion (and probably yours, if you&#8217;ve found this article) is lack of a sidebar on your single posts and pages.</p>
<p><a href="http://surminski.eu/2011/07/06/add-sidebar-to-single-post-in-the-wordpress-3-2-twentyeleven-theme/" target="_blank">Others</a> have pointed out viable solutions, however I wanted to stick to best practices and keep my parent theme unmodified.</p>
<p>Here I will explore how to add the sidebar to a twentyeleven child theme in only half a dozen lines of code.<br />
<span id="more-371"></span><br />
<strong>Note:</strong> More information on creating a child theme can be found <a href="http://codex.wordpress.org/Child_Themes" title="Child Themes">here</a>.</p>
<p>We&#8217;ll begin by adding the sidebar back to your posts, by copying <strong>single.php</strong> to our child theme and modifying it.</p>
<pre class="brush:html;">
            &lt;/div&gt;&lt;!-- #content --&gt;
        &lt;/div&gt;&lt;!-- #primary --&gt;

&lt;?php get_footer(); ?&gt;
</pre>
<p>Add the <strong>get_sidebar()</strong> function directly above <strong>get_footer()</strong> like so</p>
<pre class="brush:html;">
            &lt;/div&gt;&lt;!-- #content --&gt;
        &lt;/div&gt;&lt;!-- #primary --&gt;

&lt;?php get_sidebar(); ?&gt;
&lt;?php get_footer(); ?&gt;
</pre>
<p>The same can be done for <strong>page.php</strong> if you want the sidebar to appear on your pages as well.</p>
<p>Now, the other tutorials I&#8217;ve seen advise you to edit twentyeleven&#8217;s <strong>functions.php</strong> and comment out the <strong>remove_twentyeleven_body_classes()</strong> function and it&#8217;s accompanying <strong>add_action()</strong>.  You can certainly do so, but it goes against best practices, and you risk losing your modifications if you update twentyeleven.</p>
<p>In your child theme, create or modify your <strong>functions.php</strong> to contain the following.</p>
<pre class="brush:php;">
&lt;?php
function remove_twentyeleven_body_classes() {
    remove_filter( 'body_class', 'twentyeleven_body_classes' );
}
add_action( 'after_setup_theme', 'remove_twentyeleven_body_classes' );
?&gt;
</pre>
<p>Here we are removing the filter that is added in twentyeleven&#8217;s <strong>functions.php</strong>, but since the child theme&#8217;s files are processed prior to the parents, simply removing the filter is not adequate and would be overridden by the parent function.  As a result we need to add an <a href="http://codex.wordpress.org/Function_Reference/add_action" target="_blank">action</a> to remove the filter during the <a href="http://codex.wordpress.org/Plugin_API/Action_Reference" target="_blank"><strong>after_setup_theme</strong></a> action.</p>
<p>Save your files, and assuming it wasn&#8217;t already, activate the theme.<br />
That&#8217;s it.  Now you have your sidebar.</p>
]]></content:encoded>
			<wfw:commentRss>http://iamtgc.com/2011/07/15/adding-the-sidebar-to-a-twentyeleven-child-theme/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

