<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>iamtgc</title>
	
	<link>http://iamtgc.com</link>
	<description />
	<lastBuildDate>Thu, 07 Mar 2013 02:19:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Iamtgc" /><feedburner:info uri="iamtgc" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Exploring Postgres Extenstions</title>
		<link>http://feedproxy.google.com/~r/Iamtgc/~3/KRIGE6tN7K0/</link>
		<comments>http://iamtgc.com/exploring-postgres-extenstions/#comments</comments>
		<pubDate>Sun, 24 Feb 2013 00:54:45 +0000</pubDate>
		<dc:creator>tgc</dc:creator>
				<category><![CDATA[Postgres]]></category>

		<guid isPermaLink="false">http://iamtgc.com/?p=922</guid>
		<description><![CDATA[To paraphrase the PostgreSQL manual, a PostgreSQL extension collects multiple SQL objects (data types, functions, operators, operator classes, etc.) into a single package to simplify database management. To begin experimenting with this functionality, I decided to package the composite type &#8230; <a href="http://iamtgc.com/exploring-postgres-extenstions/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>To paraphrase the PostgreSQL manual, a PostgreSQL <a href="http://www.postgresql.org/docs/9.1/static/extend-extensions.html" title="PostgreSQL: Documentation: 9.1: Packaging Related Objects into an Extension" target="_blank">extension</a> collects multiple SQL objects (data types, functions, operators, operator classes, etc.) into a single package to simplify database management.</p>
<p>To begin experimenting with this functionality, I decided to package the <a href="http://iamtgc.com/returning-composite-types-in-postgres-stored-procedures/" title="Returning Composite Types in Postgres Stored Procedures" target="_blank">composite type</a> and <a href="http://iamtgc.com/implementing-zip-code-proximity-functions-in-mysql-and-postgresql/" title="Implementing Zip Code Proximity Functions in MySQL and PostgreSQL" target="_blank">functions</a> that support my ZIP code database into an extension.</p>
<p>The simplest extensions, that is those without C code, consist of three files: a SQL file, a control file, and a Makefile.<br />
<span id="more-922"></span><br />
The SQL file, <strong>zipcodes&#8211;1.0.sql</strong> in this example, contains our composite type and functions.</p>
<pre class="brush:sql;">
-- zipcodes--1.0.sql
CREATE type r_zipcode as (zip varchar, lat float, lon float, city varchar, state varchar, state_abbrev varchar, distance float);

CREATE OR REPLACE FUNCTION calculate_distance(double precision, double precision, double precision, double precision) RETURNS double precision
    AS $_$
   BEGIN
      RETURN 3959.0 * acos(sin(radians($1)) * sin(radians($3)) + cos(radians($1)) * cos(radians($3)) * cos((radians($4) - radians($2))));
   END;
   $_$
    LANGUAGE plpgsql;

CREATE OR REPLACE FUNCTION zip_proximity(character varying, double precision) RETURNS SETOF r_zipcode
    AS $_$
   DECLARE
      home_lat double precision;
      home_lon double precision;
   BEGIN
      SELECT lat, lon INTO home_lat, home_lon FROM zipcodes WHERE zip = $1;
      RETURN QUERY SELECT zip, lat, lon, city, state, state_abbrev, calculate_distance(home_lat, home_lon, lat, lon) AS distance
          FROM zipcodes
          WHERE calculate_distance(home_lat, home_lon, lat, lon) < $2
          ORDER BY distance;
   END;
   $_$
    LANGUAGE plpgsql;
</pre>
<p>Next the control file, <strong>zipcodes.control</strong> in this example, contains a comment and a version, these will appear in the database in tables such as <a href="http://www.postgresql.org/docs/9.1/static/view-pg-available-extensions.html" title="PostgreSQL: Documentation: 9.1: pg_available_extensions" target="_blank">pg_available_extensions</a>.</p>
<pre class="brush:text;">
# zipcodes.control
# zipcodes extension
comment = 'zipcodes helper functions'
default_version = '1.0'
</pre>
<p>Finally the Makefile, simply named <strong>Makefile</strong>.  Additional details on the Makefile, along with an explanation of the available variables, can be found in the Postgres <a href="http://www.postgresql.org/docs/9.1/static/extend-pgxs.html" title="PostgreSQL: Documentation: 9.1: Extension Building Infrastructure" target="_blank">extension building infrastructure</a> documentation. </p>
<pre class="brush:text;">
# Makefile
EXTENSION = zipcodes
DATA = zipcodes--1.0.sql

PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
</pre>
<p>After the files are created, proceed to install the extension with the command <strong>make install</strong>.</p>
<pre class="brush:shell;">
{663} sudo make install
/bin/sh /usr/local/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -d '/usr/local/share/postgresql/extension'
/bin/sh /usr/local/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -d '/usr/local/share/postgresql/extension'
/bin/sh /usr/local/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -m 644 ./zipcodes.control '/usr/local/share/postgresql/extension/'
/bin/sh /usr/local/lib/postgresql/pgxs/src/makefiles/../../config/install-sh -c -m 644 ./zipcodes--1.0.sql  '/usr/local/share/postgresql/extension/'
</pre>
<p>If you see an error like the following</p>
<pre class="brush:shell;">
{664} sudo make install
"Makefile", line 7: Could not find
make: fatal errors encountered -- cannot continue
</pre>
<p>you may have to use <strong>gmake</strong> instead of <strong>make</strong></p>
<p>Now connect to your database and load your new extension with <a href="http://www.postgresql.org/docs/9.1/static/sql-createextension.html" title="PostgreSQL: Documentation: 9.1: CREATE EXTENSION" target="_blank">CREATE EXTENSION</a></p>
<pre class="brush:text;">
zip_test=# create extension zipcodes;
CREATE EXTENSION
</pre>
<p>Now you can see which extensions are installed (loaded) in your database with the command <strong>\dx</strong>.</p>
<pre class="brush:text;">
zip_test=# \dx
                  List of installed extensions
   Name   | Version |   Schema   |         Description
----------+---------+------------+------------------------------
 plpgsql  | 1.0     | pg_catalog | PL/pgSQL procedural language
 zipcodes | 1.0     | public     | zipcodes helper functions
(2 rows)
</pre>
<p>And you can see what objects your extension provides with the command <strong>\dx+ <em>extension name</em></strong>.</p>
<pre class="brush:text;">
zip_test=# \dx+ zipcodes
                                 Objects in extension "zipcodes"
                                        Object Description
--------------------------------------------------------------------------------------------------
 function calculate_distance(double precision,double precision,double precision,double precision)
 function zip_proximity(character varying,double precision)
 type r_zipcode
(3 rows)
</pre>
<img src="http://feeds.feedburner.com/~r/Iamtgc/~4/KRIGE6tN7K0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://iamtgc.com/exploring-postgres-extenstions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://iamtgc.com/exploring-postgres-extenstions/</feedburner:origLink></item>
		<item>
		<title>Unique Per Post Sidebar Content in WordPress</title>
		<link>http://feedproxy.google.com/~r/Iamtgc/~3/N_KSXDotv8E/</link>
		<comments>http://iamtgc.com/unique-per-post-sidebar-content-wordpress/#comments</comments>
		<pubDate>Wed, 23 Jan 2013 13:43:50 +0000</pubDate>
		<dc:creator>tgc</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://iamtgc.com/?p=852</guid>
		<description><![CDATA[WordPress offers a great deal of flexibility in the content of your sidebar, but one option that seems to come up time and again is the need to include unique, per post, sidebar content. Perhaps you write restaurant reviews, and &#8230; <a href="http://iamtgc.com/unique-per-post-sidebar-content-wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>WordPress offers a great deal of flexibility in the content of your sidebar, but one option that seems to come up time and again is the need to include unique, per post, sidebar content.  Perhaps you write restaurant reviews, and you want to include a map to the restaurant.  Or maybe you write book reviews, and you want to include an Amazon Product Link.  In either of these cases the content could be included in the body of your post, but what if you wanted to include it in the sidebar?  This article will walk you through, step by step, how you can customize your sidebar on a per post basis.<br />
<span id="more-852"></span><br />
Some themes may already have this capability included, but if you&#8217;re reading this, chances are your theme is not one of them. Here we will look the implementation for WordPress&#8217; <a href="http://wordpress.org/extend/themes/twentytwelve" title="WordPress &#8250; Twenty Twelve &laquo; Free WordPress Themes" target="_blank">Twenty Twelve</a> theme.</p>
<p>Our implementation depends on <a href="http://codex.wordpress.org/Custom_Fields" title="Custom Fields &laquo; WordPress Codex" target="_blank">Custom Fields</a>, so before we start, make sure Custom Fields are selected in your post <a href="http://codex.wordpress.org/Administration_Panels#Screen_Options" title="Administration Screens &laquo; WordPress Codex" target="_blank">Screen Options</a>.</p>
<p><a href="http://iamtgc.com/wp-content/uploads/2013/01/wp-custom-fields.png" rel="colorbox" ><img src="http://iamtgc.com/wp-content/uploads/2013/01/wp-custom-fields-1024x436.png" alt="wp-custom-fields" width="640" height="272" class="aligncenter size-large wp-image-853" /></a></p>
<p>Once you&#8217;re displaying Custom Fields, let&#8217;s go ahead and create one, the Custom Fields area appears on the Edit Post screen.  Here I&#8217;ve named it <em>Unique Sidebar Content</em>, but you&#8217;re welcome to name it what you&#8217;d like, this name will be the same across all of your posts.</p>
<p>The value of <em>Unique Sidebar Content</em> for this post is <em>Unique content for post 1</em>. This could be your Google Map, Amazon Product Link, etc.</p>
<p><a href="http://iamtgc.com/wp-content/uploads/2013/01/wp-custom-field-populated.png" rel="colorbox" ><img src="http://iamtgc.com/wp-content/uploads/2013/01/wp-custom-field-populated-1024x356.png" alt="wp-custom-field-populated" width="640" height="222" class="aligncenter size-large wp-image-858" /></a></p>
<p>Now that we have our Custom Field, we modify <strong>sidebar.php</strong> to display the custom field.</p>
<p><strong>Note:</strong> If you are modifying themes, you should do so using <a href="http://codex.wordpress.org/Child_Themes" title="Child Themes">child themes</a>.  Child themes help to preserve your modifications during upgrades, and makes backing out your changes easier if you break something.<br />
<strong>Note 2:</strong> The only modifications I&#8217;ve made to the vanilla Twenty Twelve <strong>sidebar.php</strong> are adding lines 4-8.<br />
<strong>Note 3:</strong> Lines 5 and 6 refer to <em>Unique Sidebar Content</em>, if you&#8217;re using a different name, make sure that name is reflected here.<br />
<strong>Note 4:</strong> If you have no widgets in your sidebar, <strong>is_active_sidebar()</strong> is false, and our code is never reached.</p>
<p>Your modified <strong>sidepar.php</strong> should resemble the following. </p>
<pre class="brush:php;">
&lt;?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?&gt;
        &lt;div id="secondary" class="widget-area" role="complementary"&gt;
                &lt;?php dynamic_sidebar( 'sidebar-1' ); ?&gt;
                &lt;?php
                if ( is_single() &#038;&#038; get_post_meta( $post->ID, 'Unique Sidebar Content', true ) ) :
                        echo get_post_meta( $post->ID, 'Unique Sidebar Content', true );
                endif;
                ?&gt;
        &lt;/div&gt;&lt;!-- #secondary --&gt;
&lt;?php endif; ?&gt;
</pre>
<p>After you&#8217;ve made these changes, load some posts that you&#8217;ve edited to include the Custom Field.</p>
<p><a href="http://iamtgc.com/wp-content/uploads/2013/01/wp-post-with-custom-sidebar.png" rel="colorbox" ><img src="http://iamtgc.com/wp-content/uploads/2013/01/wp-post-with-custom-sidebar-1024x390.png" alt="wp-post-with-custom-sidebar" width="640" height="243" class="aligncenter size-large wp-image-861" /></a></p>
<p><a href="http://iamtgc.com/wp-content/uploads/2013/01/wp-post2-with-custom-sidebar.png" rel="colorbox" ><img src="http://iamtgc.com/wp-content/uploads/2013/01/wp-post2-with-custom-sidebar-1024x393.png" alt="wp-post2-with-custom-sidebar" width="640" height="245" class="aligncenter size-large wp-image-867" /></a></p>
<p>Success!</p>
<p><strong>WIDGET APPROACH</strong></p>
<p>If you want more flexibility in where in your sidebar the unique content will appear, or you just don&#8217;t want to edit sidebar.php, you can achieve the same result with a widget and the help of the <a href="http://wordpress.org/extend/plugins/php-code-widget/" title="WordPress &#8250; PHP Code Widget &laquo; WordPress Plugins" target="_blank">PHP Code Widget Plugin</a>.</p>
<p>The steps relating to the creation of your Custom Fields remain the same, however instead of modifying sidebar.php, you would create a PHP Code Widget containing the following.</p>
<pre class="brush:php;">
&lt;?php
if ( is_single() ) :
     global $post;
     if ( get_post_meta( $post->ID, 'Unique Sidebar Content', true ) ) :
          echo get_post_meta( $post->ID, 'Unique Sidebar Content', true );
     endif;
     wp_reset_postdata();
endif;
?&gt;
</pre>
<p>Now you&#8217;ll be able to rearrange your sidebar&#8217;s custom content as you can any other widget.</p>
<img src="http://feeds.feedburner.com/~r/Iamtgc/~4/N_KSXDotv8E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://iamtgc.com/unique-per-post-sidebar-content-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://iamtgc.com/unique-per-post-sidebar-content-wordpress/</feedburner:origLink></item>
		<item>
		<title>Implementing a Lightbox in WordPress</title>
		<link>http://feedproxy.google.com/~r/Iamtgc/~3/Jbkut3chhQM/</link>
		<comments>http://iamtgc.com/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/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/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/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>
<img src="http://feeds.feedburner.com/~r/Iamtgc/~4/Jbkut3chhQM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://iamtgc.com/implementing-a-lightbox-in-wordpresss/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://iamtgc.com/implementing-a-lightbox-in-wordpresss/</feedburner:origLink></item>
		<item>
		<title>Move the Navigation Bar in a Twentyeleven Child Theme</title>
		<link>http://feedproxy.google.com/~r/Iamtgc/~3/tPk0bxyQxyA/</link>
		<comments>http://iamtgc.com/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/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>
<img src="http://feeds.feedburner.com/~r/Iamtgc/~4/tPk0bxyQxyA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://iamtgc.com/move-the-navigation-bar-in-a-twentyeleven-child-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://iamtgc.com/move-the-navigation-bar-in-a-twentyeleven-child-theme/</feedburner:origLink></item>
		<item>
		<title>Add Pinterest’s “Pin It” Button To Your WordPress Blog</title>
		<link>http://feedproxy.google.com/~r/Iamtgc/~3/4oYRoOdyNtI/</link>
		<comments>http://iamtgc.com/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/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>
<img src="http://feeds.feedburner.com/~r/Iamtgc/~4/4oYRoOdyNtI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://iamtgc.com/add-pinterests-pin-it-button-to-your-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://iamtgc.com/add-pinterests-pin-it-button-to-your-wordpress-blog/</feedburner:origLink></item>
	</channel>
</rss>
