<?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>Code Garage Blog &#187; Wordpress</title>
	<atom:link href="http://codegarage.com/blog/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://codegarage.com/blog</link>
	<description></description>
	<lastBuildDate>Tue, 27 Sep 2011 16:39:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>The WordPress $Post Object and You</title>
		<link>http://codegarage.com/blog/2011/09/the-wordpress-post-object-and-you/</link>
		<comments>http://codegarage.com/blog/2011/09/the-wordpress-post-object-and-you/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 21:59:17 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[The Loop]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[get_post()]]></category>
		<category><![CDATA[post object]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=384</guid>
		<description><![CDATA[Ah, fair $post object. Lets talk about how great you are. The What What? Post Object. WordPress stores all post data (think content, author, tags, etc) in a single object, accessible to themes and plugins on each page load. Basically, this is the place you&#8217;re going to go to if you want to get some ...]]></description>
			<content:encoded><![CDATA[<p>Ah, fair $post object.  Lets talk about how great you are.</p>
<h2>The What What?</h2>
<p>Post Object.  WordPress stores all post data (think content, author, tags, etc) in a single object, accessible to themes and plugins on each page load. Basically, this is the place you&#8217;re going to go to if you want to get some extra information about a post for whatever clever scheme you&#8217;ve got cooked up. Need to know how many &#8220;n&#8221;s are in this particular post?  Talk to the post object.  Not sure when this post was originally published?  Post object.  Looking for lawyers who ride?  Now we&#8217;re talking &#8211; but you want the <a href="http://www.lawtigers.com/">Law Tigers</a>, not the $post object.  Watch their commercials.  You won&#8217;t regret it.</p>
<h2>How do I get at this mystical post object?</h2>
<h3>Single Posts</h3>
<p>The post object is available nearly everywhere you&#8217;re likely to be looking at a post.  If you&#8217;re working with a single post page, or an actual page, you&#8217;ve got access to that post&#8217;s (or page&#8217;s) post object anywhere within your theme file.  It&#8217;s all held in a variable named $post.</p>
<h3>Multiple Posts</h3>
<p>If you&#8217;re on a page with multiple posts, things are a little trickier but not much.  If you&#8217;re inside the loop, you&#8217;ve got access to a $post object (named $post) referring to the <strong>current</strong> post in the loop.</p>
<h3>Elsewhere</h3>
<p>What if you want to get at a post that <strong>isn&#8217;t</strong> the one you&#8217;re looking at on a particular page &#8211; or what if you want to get at one from a plugin, or somewhere where there isn&#8217;t a current post explicitly defined? There&#8217;s a function for that:</p>
<pre class="brush: php">
$id = 41;
$mypost = get_post($id);
print_r($mypost);
</pre>
<p>get_post() to the rescue!  There are, however, a couple of gotchas with get_post. </p>
<ol>
<li><strong>You have to pass it a variable &#8211; not an integer</strong>.  See how in the example above, I set $id to 41, an then used $id as the argument to get_post(), instead of just saying get_post(41)?  That&#8217;s important.  If you try to pass an integer to get_post(), it will blow up.  No Joke.</li>
<li><strong>You probably shouldnt use the variable $post.</strong>  Why not?  Because WordPress uses $post all the time, and chances are you&#8217;ll either overwrite WordPress&#8217; version of $post, or they&#8217;ll overwrite yours &#8211; either way, somebody is going to be mad.  Choose something more clever than $post (like $mypost!).  I know you can do it.</li>
</ol>
<h3>What if I don&#8217;t like getting the data back as an object?  I&#8217;m an associative array kind of guy.</h3>
<p>get_post() gets you.  So do I.  There&#8217;s a second, optional argument to get_post that determines what it spits out at you.  It defaults to OBJECT, but you can also pass in ARRAY_A, or ARRAY_N to get an associative array or a numeric array version of the post data.</p>
<h2>Ok, I&#8217;ve got a post object &#8211; what kind of data is in there?</h2>
<p>Find out for yourself!  The snippet above uses the function <strong>print_r()</strong> &#8211; it will show you the structure AND data of a particular post object &#8211; very useful stuff.  Surround it in a &lt;pre&gt; tag, and you&#8217;ll be in even better shape &#8211; it will display nicely in your browser.</p>
<h3>I&#8217;m too lazy for that.  Didn&#8217;t I come here for <strong>you</strong> to teach <strong>me</strong> about this?</h3>
<p>Well played.  Here&#8217;s a quick rundown on the data the post object gives you:</p>
<table class="small">
<thead>
<tr>
<th>Property</th>
<th>Example</th>
<th>Explanation</th>
</tr>
</thead>
<tr>
<td>$post->post_title</td>
<td>The WordPress $Post Object and You</td>
<td>Title of post.</td>
</tr>
<tr>
<td>$post->post_excerpt</td>
<td>Learn about the WordPress $Post object!</td>
<td><strong>Manually created</strong> post excerpt.  If you didn&#8217;t purposefully create an excerpt on the add post page, you&#8217;re not getting anything here.</td>
</tr>
<tr>
<td>$post->post_status</td>
<td>
<ul>
<li>publish</li>
<li>pending</li>
<li>draft</li>
<li>auto-draft</li>
<li>future</li>
<li>private</li>
<li>inherit</li>
<li>trash</li>
</ul>
</td>
<td>Current status of the post.</td>
</tr>
<tr>
<td>$post->comment_status</td>
<td>
<ul>
<li>open</li>
<li>closed</li>
<li>registered_only</li>
</ul>
</td>
<td>Comment status for this particular post.</td>
</tr>
<tr>
<td>$post->ping_status</td>
<td>
<ul>
<li>open</li>
<li>closed</li>
</ul>
</td>
<td>Does the current post accept pingbacks and trackbacks?</td>
</tr>
<tr>
<td>$post->post_password</td>
<td>
123456
</td>
<td>The plaintext password for this post, if there is one.  Empty otherwise.</td>
</tr>
<tr>
<td>$post->post_name</td>
<td>
the-wordpress-post-object-and-you
</td>
<td>A normalized, sanitized version of the post title, used to generate pretty permalinks.</td>
</tr>
<tr>
<td>$post->to_ping</td>
<td>
http://technorati.com http://someothersitetoping.com
</td>
<td>Space separated list of sites to ping <strong>which have not been pinged yet</strong>.  Modified by &#8220;Send Trackbacks&#8221; field on add post page.</td>
</tr>
<tr>
<td>$post->pinged</td>
<td>
http://technorati.com http://someothersitetoping.com
</td>
<td>Space separated list of sites already pinged for this post.</td>
</tr>
<tr>
<td>$post->post_modified</td>
<td>
2011-09-15 21:21:59
</td>
<td>Time this post was last modified, based on local server time. MySQL timestamp format.</td>
</tr>
<tr>
<td>$post->post_modified_gmt</td>
<td>
2011-09-15 21:21:59
</td>
<td>Time this post was last modified, based on GMT timezone. MySQL timestamp format.</td>
</tr>
<tr>
<td>$post->post_content_filtered</td>
<td>
Post Content
</td>
<td>This field is designed to hold a version of the post for caching, in situations where filters are being run on the post that are &#8220;expensive&#8221; (slow), and undesireable to run every time.  Not used in WP core, may be used by plugins.</td>
</tr>
<tr>
<td>$post->post_parent</td>
<td>
0
</td>
<td>ID of the parent post.  Posts that have parents are generally revisions, or attachments.  If the post_parent is 0, this is a bona-fide, original post.</td>
</tr>
<tr>
<td>$post->guid</td>
<td>
<p>http://codegarage.com/blog/?p=41</p>
</td>
<td>Global Unique Identifier for the post.  According to the documentation page on wordpress.org, this can&#8217;t be relied on to actually work as a link to the post, but I&#8217;m not totally sure why.  Maybe in cases where the site url has changed?</td>
</tr>
<tr>
<td>$post->menu_order</td>
<td>
0
</td>
<td>Integer determining the order in a list of posts.  Generally used for pages in menus, but can be used by plugins for special ordering.</td>
</tr>
<tr>
<td>$post->post_type</td>
<td>
<ul>
<li>post</li>
<li>page</li>
<li>attachment</li>
</ul>
</td>
<td>The particular type of post this is.  Attachments are generally images, pdfs, etc.  Posts and pages are self explanatory.</td>
</tr>
<tr>
<td>$post->mime_type</td>
<td>
image/png
</td>
<td>Mime type for attachments.</td>
</tr>
<tr>
<td>$post->comment_count</td>
<td>
14
</td>
<td>Number of comments on this post currently.</td>
</tr>
<tr>
<td>$post->post_ancestors</td>
<td>
array
</td>
<td>Array of parent posts for this post.</td>
</tr>
</table>
<h2>Whew!</h2>
<p>I think that about covers it.  One last question you might have:<br />
<a href="http://codegarage.com/blog/2009/05/how-to-display-properly-formatted-content-from-a-post-object-in-wordpress/" title="How to Display Properly Formatted Content From a $post Object in WordPress">How do I get WordPress to spit out properly formatted post content?</a></p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/09/the-wordpress-post-object-and-you/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress Timthumb.php Vulnerability Scanner Plugin</title>
		<link>http://codegarage.com/blog/2011/09/wordpress-timthumb-vulnerability-scanner-plugin/</link>
		<comments>http://codegarage.com/blog/2011/09/wordpress-timthumb-vulnerability-scanner-plugin/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 20:20:47 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Plugin Releases]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[cleanup]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[timthumb]]></category>
		<category><![CDATA[Upgrade]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=373</guid>
		<description><![CDATA[Over the past few weeks, I&#8217;ve been absolutely inundated with requests to clean up hacks that have exploited the much publicized Timthumb.php vulnerability. I have to assume that the reason most people aren&#8217;t plugging up this security hole on their sites is either They don&#8217;t feel confident in their ability to find the problem They ...]]></description>
			<content:encoded><![CDATA[<p><object width="620" height="349"><param name="movie" value="http://www.youtube.com/v/MFt_XmCMAfI?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/MFt_XmCMAfI?version=3" type="application/x-shockwave-flash" width="620" height="349" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Over the past few weeks, I&#8217;ve been absolutely inundated with requests to clean up hacks that have exploited the much publicized <a href="http://codegarage.com/blog/2011/08/how-to-clean-up-the-timthumb-security-vulnerability/" title="How to Clean Up the TimThumb Security Vulnerability">Timthumb.php vulnerability</a>.  I have to assume that the reason most people aren&#8217;t plugging up this security hole on their sites is either </p>
<ol>
<li>They don&#8217;t feel confident in their ability to find the problem</li>
<li>They feel like the process to fix it is too complicated</li>
</ol>
<p>To combat this, I took a couple of hours this morning to write a plugin that will do the dirty work for you.  The WordPress Timthumb Vulnerability Scanner will check your entire wp-content directory (including all themes, plugins, and uploads) for any vulnerable (pre-2.0) instances of the timthumb script, and give you a one-click upgrade to upgrade each script to the latest, secure version.</p>
<h3>The process is simple:</h3>
<ol>
<li>Download the plugin here:<br />
<a href="http://wordpress.org/extend/plugins/timthumb-vulnerability-scanner/">http://wordpress.org/extend/plugins/timthumb-vulnerability-scanner/</a></li>
<li>Install and activate using either FTP, or the built in WordPress uploader<a href="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-02-at-2.03.16-PM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-02-at-2.03.16-PM-680x484.png" alt="" title="Install the plugin" width="600" height="427" class="aligncenter size-large wp-image-374" /></a></li>
<li>Go to the &#8220;Timthumb Scanner&#8221; page, under the &#8220;Tools&#8221; menu</li>
<li><a href="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-02-at-2.12.14-PM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-02-at-2.12.14-PM-680x484.png" alt="" title="Plugin Page" width="600" height="427" class="aligncenter size-large wp-image-375" /></a><br />
Click the &#8220;Scan&#8221; button.</p>
<li>View your scan results<br />
<a href="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-02-at-2.14.55-PM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/09/Screen-Shot-2011-09-02-at-2.14.55-PM-680x484.png" alt="" title="Screen Shot 2011-09-02 at 2.14.55 PM" width="600" height="427" class="aligncenter size-large wp-image-377" /></a><br />
In this case, I&#8217;ve got one vulnerable (outdated) file, and 2 that have been updated, and are safe.  I&#8217;m going to want to upgrade that one vulnerable file &#8211; to do that, I just need to hit the &#8220;Fix&#8221; button next to it.<br />
You may not have any instances of timthumb on your site, or all of yours may be upgraded &#8211; if so, you&#8217;re all done!</li>
<li>After hitting &#8220;Fix&#8221; for my one problem file, I&#8217;m showing &#8220;No Vulnerabilities Found&#8221;, which means I&#8217;m all set.</li>
</ol>
<p>Just like that, you&#8217;re done.  Quick and painless.</p>
<p>Note: If you&#8217;ve already been hacked, this will NOT clean up your site.  This plugin fixes your door lock &#8211; which doesn&#8217;t matter if the burglars are already in your house.</p>
<p>Let me know of any problems or questions you have in the comments.</p>
<p>Good luck!</p>
<p><strong>EDIT</strong><br />
Looking for a solution to scan a whole server, or a site not running on WordPress?  By sort-of-popular demand, here it is:<br />
<a href="http://codegarage.com/plugins/timthumb-full-server-vulnerability-scanner.zip">http://codegarage.com/plugins/timthumb-full-server-vulnerability-scanner.zip</a><br />
It&#8217;s much less polished, and much less tested, so use at your own risk.</p>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/09/wordpress-timthumb-vulnerability-scanner-plugin/feed/</wfw:commentRss>
		<slash:comments>84</slash:comments>
		</item>
		<item>
		<title>Upgrading or Uploading WordPress Via FTP</title>
		<link>http://codegarage.com/blog/2011/08/upgrading-or-uploading-wordpress-via-ftp/</link>
		<comments>http://codegarage.com/blog/2011/08/upgrading-or-uploading-wordpress-via-ftp/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 19:21:04 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Filezilla]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[Upgrade]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=338</guid>
		<description><![CDATA[Yesterday we talked about how to access your WordPress site via FTP &#8211; today, we&#8217;ll talk about something more important: Upgrading or reinstalling WordPress using FTP instead of the WordPress backend. Why? Again &#8211; this all comes down to saving your own butt. If an automatic upgrade fails in the middle, you&#8217;re in trouble &#8211; ...]]></description>
			<content:encoded><![CDATA[<p><object width="620" height="490"><param name="movie" value="http://www.youtube.com/v/nQ0qJ3UYpQ8?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/nQ0qJ3UYpQ8?version=3" type="application/x-shockwave-flash" width="620" height="490" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Yesterday we talked about how to <a href="http://codegarage.com/blog/2011/08/wordpress-ftp-access-not-as-scary-as-it-sounds/" title="WordPress FTP Access:  Not as Scary as it Sounds">access your WordPress site via FTP</a> &#8211; today, we&#8217;ll talk about something more important:  Upgrading or reinstalling WordPress using FTP instead of the WordPress backend.</p>
<h3>Why?</h3>
<p>Again &#8211; this all comes down to saving your own butt.  If an automatic upgrade fails in the middle, you&#8217;re in trouble &#8211; chances are that some, but not all of the files necessary have been reinstalled/updated.  Because of this, the Dashboard is often left inaccessible, and you have to fall back on your old friend FTP.</p>
<p>Other reasons you might do this:</p>
<ol>
<li>You got hacked, and you want to make sure your core WP files are clean.</li>
<li>You started tinkering with Core WordPress files, and now the site doesn&#8217;t work</li>
<li>You uploaded a shady plugin which modified core WordPress files, and now the site doesn&#8217;t work</li>
</ol>
<h3>Public Service Announcement</h3>
<p>Back up your site before you do this.  Please.  If you mess it up, and lose all your uploads, you&#8217;re going to be really mad, maybe at me.  Don&#8217;t have a backup service?  Good news &#8211; I have one that I can shamelessly plug.  Check it out at <a href="http://codegarage.com/">the front page</a>.</p>
<p>Lets get to it.  Since we already understand how to <a href="http://codegarage.com/blog/2011/08/wordpress-ftp-access-not-as-scary-as-it-sounds/">access WordPress via FTP</a>, we can get started without fear.</p>
<h3>Step 1:  Download WordPress</h3>
<p>WordPress.org has a handy feature:  the latest version of WordPress is always available at:</p>
<p><a href="http://wordpress.org/latest.zip">http://wordpress.org/latest.zip</a></p>
<p>  If you ever need a copy, just enter that address in the url, and it will start downloading.  The more traditional page for finding your download is here:</p>
<p><a href="http://wordpress.org/download/">http://wordpress.org/download/</a></p>
<p>Need an old version of WordPress?  They&#8217;re nice enough to keep those around too:</p>
<p><a href="http://wordpress.org/download/release-archive/">http://wordpress.org/download/release-archive/</a></p>
<p>So you&#8217;ve downloaded the version of WordPress you need.  Good work!</p>
<h3>Step 2: Unzip it</h3>
<p>Next, you need to extract the zip you downloaded.  Hopefully this isn&#8217;t too tricky &#8211; as long as you know where your downloads end up.  In most cases, it&#8217;s as simple as finding the zip file and double clicking it.  You should end up with a folder titled &#8220;WordPress&#8221;, which has the entirety of a WordPress install inside of it.<br />
<a href="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-17-at-10.59.45-AM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-17-at-10.59.45-AM-680x459.png" alt="" title="Extracted WordPress Folder" width="600" height="405" class="aligncenter size-large wp-image-342" /></a></p>
<h3>Step 3: Upload it</h3>
<p>All that&#8217;s left is to upload.  Now &#8211; you need to take some special consideration before you just go uploading all these files.  Make sure you&#8217;re:</p>
<ul>
<li>Uploading the right things</li>
<li>To the right place</li>
<ul>
Simple, right?  Here&#8217;s what we need to do:  We want to upload the <strong>contents</strong> of the WordPress folder (which we just extracted) to the directory on our web server where wordpress is installed, with one important caveat:</p>
<h4>We don&#8217;t want to overwrite wp-content</h4>
<p>That deserved to be bolded.  The wp-content folder holds your themes, plugins, and uploads &#8211; and we don&#8217;t want to overwrite it with the default wordpress content.  So, we&#8217;re going to upload everything <strong>except</strong> that.<br />
<div id="attachment_344" class="wp-caption aligncenter" style="width: 610px"><a href="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-17-at-11.07.12-AM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-17-at-11.07.12-AM-680x459.png" alt="" title="Selecting Files to upload" width="600" height="405" class="size-large wp-image-344" /></a><p class="wp-caption-text">Upload Everything BUT wp-content</p></div><br />
Now that we&#8217;re ready to upload, we&#8217;ll just click and drag that mess into filezilla &#8211; making sure that in filezilla, we&#8217;re looking at the current wordpress install (you should be looking at the inside of a directory that has wp-load.php in it).<br />
<a href="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-17-at-11.10.24-AM.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-17-at-11.10.24-AM-680x496.png" alt="" title="Upload Here" width="600" height="437" class="aligncenter size-large wp-image-345" /></a><br />
When it asks if you&#8217;d like to overwrite files, go ahead and check &#8220;Overwite&#8221;, as well as &#8220;Always use this action&#8221; and click &#8220;Ok&#8221;.  Before clicking &#8220;Ok&#8221; would be a good time to double check that you&#8217;ve backed up, adn you&#8217;re not overwriting wp-content.</p>
<p>Now, this is going to take a while &#8211; WordPress has a lot of files.  Go eat a sandwich, it will be done when you get back.</p>
<h3>All done.  Now what?</h3>
<p>Now head back over to your site and get a feel for your handiwork.  If you were just trying to fix a problem, ideally at this point your site is working again.  If the upload went ok, and your site <strong>still isn&#8217;t working</strong>, the problem lies somewhere else &#8211; check your plugins and themes if you haven&#8217;t already.</p>
<p>If you were doing this to upgrade your WordPress install, you&#8217;ve got one more step.  Head over to yoursite.com/wp-admin, and you should be presented with a screen saying you need to upgrade your database.  Go ahead and approve that, give it a minute to think, and you should be redirected to the login page &#8211; and you&#8217;re done!</p>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/08/upgrading-or-uploading-wordpress-via-ftp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress FTP Access:  Not as Scary as it Sounds</title>
		<link>http://codegarage.com/blog/2011/08/wordpress-ftp-access-not-as-scary-as-it-sounds/</link>
		<comments>http://codegarage.com/blog/2011/08/wordpress-ftp-access-not-as-scary-as-it-sounds/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 23:27:03 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=324</guid>
		<description><![CDATA[What is FTP? FTP is short for File Transfer Protocol. Pretty self explanatory &#8211; you have files on your computer, you want them on your website, so you transfer them. FTP facilitates this. When and Why do I need to use it? Like I said, WordPress continues it&#8217;s relentless path toward becoming completely free of ...]]></description>
			<content:encoded><![CDATA[<p><object width="620" height="374"><param name="movie" value="http://www.youtube.com/v/XHzO-iPm4fM?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/XHzO-iPm4fM?version=3" type="application/x-shockwave-flash" width="620" height="374" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h3>What is FTP?</h3>
<p>FTP is short for <strong>File Transfer Protocol</strong>.  Pretty self explanatory &#8211; you have files on your computer, you want them on your website, so you transfer them.  FTP facilitates this.</p>
<h3>When and Why do I need to use it?</h3>
<p>Like I said, WordPress continues it&#8217;s relentless path toward becoming completely free of scary acronyms like FTP, but there are still times when you need it &#8211; mostly when things go wrong:</p>
<ul>
<li>Your WordPress site broke during an upgrade, now you can&#8217;t get in.</li>
<li>You&#8217;ve got a broken plugin that has made your site inaccessible</li>
<li>You were tinkering with your theme, and now you&#8217;ve got a big error message on every page of your site &#8211; or worse, just a <strong>scary blank screen</strong></li>
<li>You keep getting errors and notices about &#8220;Permissions&#8221; issues</li>
</ul>
<h3>Ok, so Maybe I Need It.  Now what?</h3>
<p><strong>Step 1:</strong> Get an FTP client.<br />
&#8220;FTP Client&#8221; is just nerdy talk for &#8220;Program you use to upload your files to your website&#8221;.  There are as many FTP clients as there are fish in the sea, but I&#8217;m just going to tell you to use <a href="http://filezilla-project.org/">FileZilla</a>, because it&#8217;s free, and easy to use.  Download and install it, and get back here.</p>
<p><strong>Step 2:</strong> Figure out your FTP credentials.<br />
More nerd speak &#8211; you just need the login and password (and maybe ftp url) your host gave you for FTP access.  This information is often in your &#8220;Welcome to your new hosting account&#8221; email.</p>
<p><strong>Step 3:</strong> Connect!<br />
Alright &#8211; fire up your FTP Client (See?  You&#8217;re talking like a real nerd! Drop that one on your boss.  He&#8217;ll give you a raise and a new job title.) In filezilla, we&#8217;re just going to use the &#8220;QuickConnect&#8221; bar &#8211; <a href="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-16-at-4.11.47-PM1.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-16-at-4.11.47-PM1-680x59.png" alt="" title="QuickConnect" width="600" height="52" class="aligncenter size-large wp-image-330" /></a><br />
<strong>Host</strong>: This is usually your site&#8217;s url (like codegarage.com), but sometimes it&#8217;s something different.  If it&#8217;s different, they&#8217;d have told you in the same place you found your username and password.  You did find your username and password already, right?<br />
<strong>Username</strong>:  Your username.  Take note:  you might have to include the domain name afterward, like an email address (like peter@codegarage.com).<br />
<strong>Password</strong>: Your Password.</p>
<p>Next stop, the &#8220;Quickconnect&#8221; button.  Go ahead, click it.  You&#8217;re not in a position to break anything.  Yet.</p>
<h3>You&#8217;re In!</h3>
<p>Hopefully.  If not, you&#8217;ve probably got one of those fields wrong &#8211; host, username, or password.  Do some tinkering.<br />
If you got in, you&#8217;ll see the window on the bottom right corner of the screen fill up with some folders (or maybe just a few).  These are the files on your server!  Go ahead, do some exploring.  When you&#8217;re ready to upload a file (send it from your computer to the website), just drag it on into that window on the right, and it will get sent to the website.<br />
<a href="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-16-at-4.16.33-PM1.png"><img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-Shot-2011-08-16-at-4.16.33-PM1-680x483.png" alt="" title="Screen Shot 2011-08-16 at 4.16.33 PM" width="600" height="426" class="aligncenter size-large wp-image-331" /></a><br />
That&#8217;s it!  Good work!</p>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/08/wordpress-ftp-access-not-as-scary-as-it-sounds/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Change Your WordPress Table Prefix</title>
		<link>http://codegarage.com/blog/2011/08/how-to-change-your-wordpress-table-prefix/</link>
		<comments>http://codegarage.com/blog/2011/08/how-to-change-your-wordpress-table-prefix/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 17:30:12 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[Table Prefix]]></category>

		<guid isPermaLink="false">http://codegarage.com/blog/?p=311</guid>
		<description><![CDATA[Lately, WordPress users seem to have had an increased interest in security &#8211; and with good reasons. Yesterday&#8217;s timthumb.php vulnerability, plus a slew of others in the past few months have really put most site owners on edge. Often it&#8217;s recommended that as a WordPress site owner, you change your WordPress database table prefix to ...]]></description>
			<content:encoded><![CDATA[<p>Lately, WordPress users seem to have had an increased interest in security &#8211; and with good reasons.  Yesterday&#8217;s timthumb.php vulnerability, plus a slew of others in the past few months have really put most site owners on edge.  </p>
<p>Often it&#8217;s recommended that as a WordPress site owner, you change your WordPress database table prefix to something other than wp_.  It&#8217;s not a bad idea &#8211; in certain situations, doing so might prevent a hacker from gaining more access to your site, or limit his destructive capability, and it&#8217;s a very easy thing to change.</p>
<h3>If You&#8217;re Installing WordPress</h3>
<p>If you&#8217;re installing WordPress, and you havent run through the install process, changing your table prefix is incredibly simple.  During the install process, just set the Table Prefix to anything you&#8217;d like:<br />
<img src="http://codegarage.com/blog/wp-content/uploads/2011/08/wp_prefix_change_install.png" alt="" title="wp_prefix_change_install" width="600" height="423" class="aligncenter size-full wp-image-314" /></p>
<h3>If You&#8217;ve Already Installed WordPress</h3>
<p>If you&#8217;ve already installed WordPress, you can still change your table prefix, but it&#8217;s a little more complicated.  You&#8217;re going to need to have access to your database through PHPMyAdmin or a similar system.</p>
<ol>
<li>First, open your wp-config.php file (You&#8217;ll need to download this via FTP, or get at it from your host&#8217;s file manager).  This file is usually located in the web root of your site.</li>
<li>Now, scan down until you see a line that starts with &#8216;$table_prefix&#8217;.  It will look something like this:
<pre class="brush: php">
/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = &#039;wp_&#039;;
</pre>
<p>Change the value between the quotes (after the = sign) to whatever you&#8217;d like:</p>
<pre class="brush: php">
/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = &#039;mysecretprefix_&#039;;
</pre>
</li>
<li>Upload the file to your site, replacing the old wp-config.php file (If you made these changes from the built in file editor for your host &#8211; like cPanel, you just need to click the &#8220;save&#8221; button).
<p>At this point, your site will totally stop working.   Yikes!  Fortunately, we can fix that by changing some things in the database (Remember how you were supposed to make sure you had database access before we started?  If you don&#8217;t, change wp_config.php back to the way it was, quick!).
</li>
<li>Fire up PHPMyAdmin (or the MySQL client of your choice), and connect to the database for this WordPress install.</li>
<li>Run through each table starting with wp, and rename it, as follows:
<ol>
<li>Click on the table name in the left sidebar</li>
<li>Click on the &#8220;Operations&#8221; tab</li>
<li>Change &#8220;wp_&#8221; to &#8220;mysecretprefix_&#8221; in the upper right field<img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-shot-2011-08-03-at-11.04.39-AM.png" alt="" title="Change Table Prefix" width="600" height="393" class="aligncenter size-full wp-image-319" /></li>
<li>Repeat for each table</li>
<p>At this point, your site should be working properly again, with one important caveat:  You get a permissions error when you try to log in.  That leads us to our last set of steps:
</li>
<p> Choose the mysecretprefix_usermeta table, and look for a row with a user_id of 1 (or whatever your user&#8217;s id is &#8211; it&#8217;s probably 1), and a &#8220;meta_key&#8221; value of &#8220;wp_capabilities&#8221;.  Once you&#8217;ve found this.  Click the pencil toward the left (edit)</li>
<li>Replace the wp_ in the meta_key row to &#8220;mysecretprefix_&#8221;<br />
<img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-shot-2011-08-03-at-11.12.02-AM.png" alt="" title="Screen-shot-2011-08-03-at-11.12.02-AM" width="600" height="393" class="aligncenter size-full wp-image-320" /></li>
<li>You need to make this same change to 2 more records &#8211; wp_user_level (located in wp_usermeta &#8211; again, make sure you&#8217;re changing it for the right user), and wp_user_roles, which is in the mysecretprefix_options table.  Both of them should have wp_ replaced with mysecretprefix_.</li>
<li>All done!</li>
</ol>
<h3>If You&#8217;re Installing WordPress, and You&#8217;re Not Interested in all that Hassle:</h3>
<p>This one probably should have gone first:  The plugin <a href="http://www.google.com/search?sourceid=chrome&#038;ie=UTF-8&#038;q=wp+security+scan">WP Security Scan</a> from <a href="http://www.websitedefender.com/blog/">WebsiteDefender</a> will do all the dirty work for you in most cases.  Just go to the &#8220;Database&#8221; page, and switch your prefix.<br />
<img src="http://codegarage.com/blog/wp-content/uploads/2011/08/Screen-shot-2011-08-03-at-11.26.38-AM.png" alt="" title="WP Security Scan" width="600" height="343" class="aligncenter size-full wp-image-321" /></p>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/08/how-to-change-your-wordpress-table-prefix/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Customizing WordPress:  an Introduction</title>
		<link>http://codegarage.com/blog/2011/03/customizing-wordpress-an-introduction/</link>
		<comments>http://codegarage.com/blog/2011/03/customizing-wordpress-an-introduction/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 16:00:42 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Customization]]></category>
		<category><![CDATA[Tweaking Your Theme]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Premium themes]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Wordpress Customization]]></category>

		<guid isPermaLink="false">http://yourcodegarage.com/blog/?p=274</guid>
		<description><![CDATA[WordPress is an amazingly flexible, powerful content management system &#8211; it can do a lot of things for a lot of different people, and can can be contorted to match the requirements of impossibly different businesses. All for free. Right, but I just want to change my header Of course. Lets talk about how you ...]]></description>
			<content:encoded><![CDATA[<p>WordPress is an amazingly flexible, powerful content management system &#8211; it can do a lot of things for a lot of different people, and can can be contorted to match the requirements of impossibly different businesses.  All for free.</p>
<h3>Right, but I just want to change my header</h3>
<p>Of course.  Lets talk about how you can go about making small customizations to your WordPress based site. There are routes to take for people of all ability levels &#8211; so don&#8217;t be afraid if you&#8217;re still not exactly sure what &#8220;hosting&#8221; means.</p>
<p>I&#8217;m going to give 2 paths here, one for people who don&#8217;t know html and css from arugula, and one for those who do, even if it&#8217;s just barely.</p>
<h3>The easy way out: Choosing a flexible theme</h3>
<p>Over the past 12-18 months, the WordPress community has exploded with a new class of themes &#8211; heavily customizable and easy to use, even for those with little or no html and css ability.  I&#8217;m going to talk about 3 themes here &#8211; 2 paid, and one free.  Feel free to chime in in the comments with your personal favorite.</p>
<h3>Headway</h3>
<p><a href="http://headwaythemes.com"><img src="http://yourcodegarage.com/blog/wp-content/uploads/2011/03/Screen-shot-2011-03-06-at-3.08.20-PM.png" alt="" title="Screen shot 2011-03-06 at 3.08.20 PM" width="191" height="88" class="alignleft size-full wp-image-280" /></a>Headway is my favorite.  It&#8217;s not free, in fact, it&#8217;s not even cheap &#8211; but in my opinion, their visual editor is really fantastic &#8211; and just what a beginning WordPress user needs to get them up and running with a great looking, customized theme.  <a href="http://headwaythemes.com">Click here to visit Headway</a>.</p>
<h3>Thesis</h3>
<p><a href="http://diythemes.com"><img src="http://yourcodegarage.com/blog/wp-content/uploads/2011/03/Screen-shot-2011-03-06-at-3.08.31-PM.png" alt="" title="Screen shot 2011-03-06 at 3.08.31 PM" width="217" height="57" class="alignleft size-full wp-image-281" /></a>Thesis has been around since the beginning of paid themes.  It&#8217;s hugely popular and has a rabid following.  It&#8217;s not my favorite for a number of reasons, but how wrong can 35,000 people be?  <a href="http://diythemes.com">Click here to visit Thesis</a></p>
<h3>Atahualpa</h3>
<p><a href="http://wordpress.bytesforall.com/?page_id=40"><img src="http://yourcodegarage.com/blog/wp-content/uploads/2011/03/Screen-shot-2011-03-06-at-3.11.57-PM.png" alt="" title="Screen shot 2011-03-06 at 3.11.57 PM" width="206" height="72" class="alignleft size-full wp-image-282" /></a>Atahualpa is another tricky one.  It&#8217;s very popular, and refreshingly, it&#8217;s free!  However, there is a pretty steep learning curve that comes along with it.  If you&#8217;ve got the patience to power through the learning stage, you&#8217;ll no doubt be very excited with the end product. <a href="http://wordpress.bytesforall.com/?page_id=40">Click here to visit the Atahualpa homepage</a></p>
<h3>The Road Less Travelled &#8211; Modifying theme code yourself</h3>
<p>The other option is a little less glamourous, and a lot more migraine inducing, but the possibilities are limitless.  WordPress works on a templating system that is both easy to use, and robust enough to let you do anything you want it to.  The kicker is:  you need to learn how HTML, CSS, and even a little bit of PHP if you&#8217;re going to make this work.  You don&#8217;t exactly need to be an expert in any of them to make small changes to an existing theme though.  Here&#8217;s the quick overview, and some links to get you pointed in the right direction:</p>
<h3>WordPress Theme Files</h3>
<p>Nearly every WordPress theme consists of the same basic set of files, listed here:</p>
<ul>
<li><strong>index.php</strong> Index.php is your theme&#8217;s go-to guy.  Traditionally, it controls the homepage (although if your theme has a file called &#8220;home.php&#8221;, that&#8217;s what will control your homepage).   When all else fails, index.php is the file that WordPress looks to to generate your page.</li>
<li><strong>header.php</strong> This one isn&#8217;t too tough.  Header.php controls &#8211; wait for it &#8211; your header.  In most themes, every single page on your site will share a header &#8211; so if you&#8217;re looking to add an image into your header, this is a good place to start your search.</li>
<li><strong>footer.php</strong> Another no brainer.  Looking for that hard to find copyright text?  Start checking here.</li>
<li><strong>sidebar.php</strong> More easy stuff &#8211; here&#8217;s where your sidebar code traditionally goes.</li>
<li><strong>single.php</strong> This file is in charge of single post pages &#8211; like the one you&#8217;re looking at right now.</li>
<li><strong>page.php</strong> This file is in charge of &#8220;Page&#8221; pages.  </li>
<li><strong>archive.php</strong> This file controls the layout of your archive pages &#8211; for example, the pages displayed when you click the &#8220;March 2011&#8243; link on this blog, or one of the category links in the sidebar.  A warning &#8211; categories are sometimes controlled by another file (category.php).</li>
<li><strong>style.css</strong> Here&#8217;s where things get interesting.  The style.css file is usually the single source of all CSS (which controls the actual look and feel of your blog &#8211; things like colors, layout, fonts, etc) on your theme.  Get comfortable with this file, and the CSS that it uses.</li>
</ul>
<p>That is, unfortunately, not even close to a complete list.  Fortunately, there&#8217;s a <a href="http://codex.wordpress.org/Template_Hierarchy">handy diagram at this page</a> on wordpress.org.</p>
<p>Now, you at least know where to start looking &#8211; all that&#8217;s left is to figure out what to do once you get there. Here are a couple of great tutorials to get you on your way:<br />
<a href="http://www.w3schools.com/html/default.asp">HTML Tutorial</a><br />
<a href="http://www.csstutorial.net/">CSS Tutorial</h3>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/03/customizing-wordpress-an-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress API Key:  What is it, and Why Does it Matter?</title>
		<link>http://codegarage.com/blog/2011/03/wordpress-api-key-what-is-it-and-why-does-it-matter/</link>
		<comments>http://codegarage.com/blog/2011/03/wordpress-api-key-what-is-it-and-why-does-it-matter/#comments</comments>
		<pubDate>Sun, 06 Mar 2011 21:24:22 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[setting up a blog]]></category>
		<category><![CDATA[wordpress.com]]></category>

		<guid isPermaLink="false">http://yourcodegarage.com/blog/?p=276</guid>
		<description><![CDATA[EDIT: The process has changed! You now get your api key straight from akismet. You&#8217;re going to have to withstand some awfully guilt inducing text to get it free. Consider yourself warned. When I was first starting with WordPress, there were a number of things that confused me. The distinction betwen wordpress.COM and wordpress.ORG is ...]]></description>
			<content:encoded><![CDATA[<p><strong>EDIT:</strong> The process has changed!  You now get your api key straight from <a href="https://akismet.com/signup/#free">akismet</a>.  You&#8217;re going to have to withstand some awfully guilt inducing text to get it free.  Consider yourself warned.  </p>
<p>When I was first starting with WordPress, there were a number of things that confused me.  The distinction betwen wordpress.COM and wordpress.ORG is not immediately clear, and even if it was, it&#8217;s difficult for a beginner to wrap their minds around what the difference actually means to them.  I don&#8217;t want to derail on this post and talk about that too much, so here&#8217;s what you need to know:</p>
<ul>
<li>wordpress.<em>COM</em> is a completely hosted, managed, easy to use blogging system.  Users of WordPress.com don&#8217;t need to worry about hosting, databases, installation, or any other jargon.  Think of it like blogspot.com, but using WordPress instead.</li>
<li>wordpress.<em>ORG</em> is the home of the actual software that runs WordPress.  The software is free and open source, meaning you and I can download, use, modify, and redistribute (with some limitations) as we see fit.</li>
</ul>
<p>Chances are, if you&#8217;re reading this blog, you&#8217;re using wordpress.org, and you have your own host and domain name.</p>
<h3>I thought we were talking about API Keys?</h3>
<p>Right.  Back on track.  A few plugins and other services require you to have a WordPress API Key &#8211; Most notably, Akismet (the comment spam fighting plugin that comes bundled with WordPress).  Now, when you hear WordPress API key, you assume you&#8217;ll head back to the place you downloaded WordPress from (wordpress.org), and get it there.  This is, however, wrong.  WordPress.org is a big site, and it&#8217;s possible to have an account there, so you can waste a lot of time looking for the mystical API Key.</p>
<p>The API Key you&#8217;re after is part of the <a href="http://wordpress.com/">WordPress.COM</a> ecosystem, and is available once you sign up for a free account there.  You don&#8217;t even have to set up a blog &#8211; just head over, <a href="https://en.wordpress.com/signup">sign up</a> (<a href="https://en.wordpress.com/signup/?user=1">click here to sign up without setting up a blog</a>), and navigate to your profile page, where you&#8217;ll find a link to get your API key.  Just like that, you&#8217;re all set!</p>
<p><strong>EDIT:</strong> The process has changed!  You now get your api key straight from <a href="https://akismet.com/signup/#free">akismet</a>.  You&#8217;re going to have to withstand some awfully guilt inducing text to get it free.  Consider yourself warned.  </p>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/03/wordpress-api-key-what-is-it-and-why-does-it-matter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to 301 redirect your WordPress blog to a new URL</title>
		<link>http://codegarage.com/blog/2011/03/how-to-301-redirect-your-wordpress-blog-to-a-new-url/</link>
		<comments>http://codegarage.com/blog/2011/03/how-to-301-redirect-your-wordpress-blog-to-a-new-url/#comments</comments>
		<pubDate>Sat, 05 Mar 2011 20:55:21 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[moving a site]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[redirection]]></category>

		<guid isPermaLink="false">http://yourcodegarage.com/blog/?p=262</guid>
		<description><![CDATA[Having just done this to move from apartmentonesix.com to yourcodegarage.com, I figured it would be fitting to write a quick post about how to handle this sort of redirection. What are we trying to do? It&#8217;s important to know the goal &#8211; in this case, we want to move a site from one url to ...]]></description>
			<content:encoded><![CDATA[<p>Having just done this to move from apartmentonesix.com to yourcodegarage.com, I figured it would be fitting to write a quick post about how to handle this sort of redirection.</p>
<h3>What are we trying to do?</h3>
<p>It&#8217;s important to know the goal &#8211; in this case, we want to move a site from one url to another.  For example, from</p>
<p>http://site1.com</p>
<p>to</p>
<p>http://site2.com</p>
<p>However, we&#8217;re actually moving all the content and everything over &#8211; so we want to redirect the individual urls, like this:</p>
<p>http://site1.com/post-1/</p>
<p>redirects to</p>
<p>http://site2.com/post-1/</p>
<p>That way any bookmarks or incoming links pointing at the old site will redirect properly at the new one.</p>
<h3>The Steps</h3>
<p>First things first, you need to duplicate your WordPress installation from the old site onto the new one.  Here&#8217;s the drive by version of how to do that:</p>
<h3>On the old site:</h3>
<ol>
<li><strong>Grab a backup of your files</strong><br />You don&#8217;t have to actually grab the whole wordpress install (with it&#8217;s roughly 1000 files) to accomplish this &#8211; chances are, you&#8217;ll be just fine with just the wp-content folder.  Download these files to your desktop.</li>
<li><strong>Make a dump of your database</strong><br />Using phpMyAdmin (or some other backup utility), get a copy of your database.  Download this to your desktop also.</li>
</ol>
<p>We&#8217;ll be back to thsi site in a bit to implement the redirect, but for now, we&#8217;ll move to the new site.</p>
<h3>On the new site:</h3>
<ol>
<li><strong>Upload your file backups from the old site.</strong><br />If you only downloaded the contents of the wp-content folder, you&#8217;ll need to install a fresh copy of WordPress over here, and then upload your wp-contents folder, overwriting the one that was installed with WordPress.</li>
<li><strong>Import your database backup to the new site</strong><br />Again, you&#8217;ll need to use phpMyAdmin, or a similar client to handle this.  Depending on the new hosting setup, you&#8217;re probably going to need to create a database and a database user for WordPress to use &#8211; but that should be covered by the WordPress install process from step 1.  <strong>Take Note!</strong> of your database prefix.  If you&#8217;re not sure what this is, you can look at the wp-config.php file on your old site (look for a line that starts with
<pre>$table_prefix =</pre>
</li>
<li><strong>Connect to the database</strong><br />If necessary, set up or modify the wp-config.php file for your new site, making sure it points to the database tables you just imported.  You&#8217;ll know you&#8217;re on the right track when you load up the new url, and you see your blog content there, waiting for you.  The styling might be messed up, and clicking any of the links will take you to the old site &#8211; but if you can see your content, you&#8217;ve done everything right so far.</li>
<li><strong>Switch WordPress&#8217; location values</strong><br />If you&#8217;ve tried to log in at the new site before this point, you probably had something confusing happen &#8211; you went to wp-login.php, entered your credentials, and suddenly you were back at your old URL!  This happens because of some location settings in the database files you just imported.  To fix it, you need to change 2 values in your database.  Again, you&#8217;ll need phpMyAdmin, or similar, to make these changes.  The first option you need to edit is id 1, with the &#8220;option_name&#8221; of &#8220;siteurl&#8221;.  This should currently be the url to your old site &#8211; you want it to be your new site.  Change it to that, with no trailing slash:<br />
<a href="http://yourcodegarage.com/blog/wp-content/uploads/2011/03/Screen-shot-2011-03-05-at-1.40.48-PM.png"><img class="alignleft size-large wp-image-265" title="Site Url Option in phpMyAdmin" src="http://yourcodegarage.com/blog/wp-content/uploads/2011/03/Screen-shot-2011-03-05-at-1.40.48-PM-600x173.png" alt="Site Url Option in phpMyAdmin" width="600" height="173" /></a>You need to make one more change, at about id 39 &#8211; look for an option with the option name of &#8220;home&#8221;, and change it appropriately.</li>
<li>You&#8217;re all set!  The blog should now be working at it&#8217;s new location, completely.</li>
</ol>
<h3>Redirect code for your old site</h3>
<p>All we&#8217;ve got left to do is redirect your old site to the new one.  Unfortunately, this is often the scariest and most difficult part of the entire process. On the bright side, you should be able to just paste this code in and call it done.</p>
<h3>What are we doing?</h3>
<p>To accomplish our redirect, we&#8217;re goign to modify the .htaccess file of our old site.  .htaccess is a file that you can use to give your server special instructions on how to handle certain requests to your site.  Because it starts with a dot, it&#8217;s often hidden by FTP clients &#8211; so you may have to do some tinkering to have it visible and editable to you.<br />
Here&#8217;s the code we&#8217;re going to use:</p>
<pre class="brush: php">
RewriteEngine on
RewriteRule ^(.*)$ http://yourcodegarage.com/blog/$1 [R=301,L]
</pre>
<p>Obviously, you&#8217;re going to want to replace &#8220;yourcodegarage.com/blog&#8221; with your own url.  Just put that at the top of your .htaccess file, and you should be all set. Here&#8217;s the gist of what&#8217;s happening:</p>
<pre>RewriteEngine on</pre>
<p>Here, we&#8217;re just telling the .htaccess file to make sure the rewrite engine that your webserver uses is running, and able to handle the request.</p>
<pre>RewriteRule</pre>
<p>We start the line with the word &#8220;RewriteRule&#8221;, because that&#8217;s what we&#8217;re defining &#8211; a rule for the server to use in rewriting the url and sending the user to where we want them.</p>
<pre>^(.*)$</pre>
<p>I&#8217;m not going to get into the nitty gritty of the regular expression being used here, but what you need to know is:  This section says &#8220;Match the entire url (after the domain name), and store the whole thing for me to use later in this line.&#8221;</p>
<pre>http://yourcodegarage.com/blog/$1</pre>
<p>At this point, we give the url we&#8217;d like to send the user to.  In my case, I needed to send the user to yourcodegarage.com/blog, because that&#8217;s where the blog is now located.  The $1 after that is telling the server to append whatever we found before to the end of this.  So, if the old url was</p>
<p>http://apartmentonesix.com/my-post/comments</p>
<p>then &#8220;my-post/comments&#8221; would be grabbed, and appended to the end of &#8220;http://yourcodegarage.com/blog&#8221;, ensuring that the user gets sent where he needs to go.<br />
We finish up with this:</p>
<pre>[R=301,L]</pre>
<p>All we&#8217;re saying here is use a 301 redirect (permanent), and don&#8217;t listen to any redirect rules after this one.</p>
<p>And with that, we&#8217;re all set!  Make sure you use Google Webmaster Tools to notify google of the change, and get to work blogging at your new url!</p>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2011/03/how-to-301-redirect-your-wordpress-blog-to-a-new-url/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Help!  All the posts have disappeared from my WordPress site!</title>
		<link>http://codegarage.com/blog/2010/08/help-all-the-posts-have-disappeared-from-my-wordpress-site/</link>
		<comments>http://codegarage.com/blog/2010/08/help-all-the-posts-have-disappeared-from-my-wordpress-site/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 19:20:50 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://apartmentonesix.com/?p=223</guid>
		<description><![CDATA[I do all of the development work for an SEO/MMO program over at thekeywordacademy.com. As part of the program, we&#8217;ve put together a system that facilitates guest posting on other members&#8217; sites easily. That&#8217;s all well and good &#8211; but one problem we run into fairly often is this: For whatever reason, the posts table ...]]></description>
			<content:encoded><![CDATA[<p>I do all of the development work for an SEO/MMO program over at thekeywordacademy.com.  As part of the program, we&#8217;ve put together a system that facilitates guest posting on other members&#8217; sites easily.  That&#8217;s all well and good &#8211; but one problem we run into fairly often is this:  For whatever reason, the posts table on a site goes down, and the owner&#8217;s posts are all suddenly gone &#8211; without a trace.  Naturally, they get pretty worried, and an email shows up in my inbox (or in our forum).</p>
<p>The good news is: it&#8217;s almost always just a simple myIsam crash &#8211; easy to fix, and no data loss.  After going through this a number of times with various members, I decided I really ought to put together a quick tutorial on how to fix it.</p>
<h2>Symptoms</h2>
<p>First &#8211; how do you know this is the issue you&#8217;re seeing?  The most obvious symptom is this:  Your posts have just disappeared.  The homepage of your blog is giving a 404 (but a pretty one, with your theme), or just telling you it can&#8217;t find any posts.  You log into your dashboard, and much to your dismay, the edit posts screen is showing not ONE single post.  It&#8217;s terrifying, because it&#8217;s at exactly this moment that you realize you never installed that backup plugin (or more likely, you started to, but never finished, because it got tricky).  Much cursing later, you&#8217;ve resigned to the fact that all is lost.</p>
<h2>Diagnosis</h2>
<p>Of course, it&#8217;s likely that all is not lost &#8211; lets look at how to make sure.<br />
<img class="alignright size-full wp-image-226" title="phpmyadmin-logo" src="http://yourcodegarage.com/blog/wp-content/uploads/2010/08/phpmyadmin-logo.jpeg" alt="" width="150" height="87" /></p>
<p>To get this done, you&#8217;re going to need to get direct access to your database somehow.  There are a number of ways you can do this, ranging from the super nerdy (command line/ssh access), to the moderately nerdy (MySQL gui client like <a href="http://www.sequelpro.com/" target="_blank">Sequel Pro</a>), to the entirely accessible &#8211; the web based interface of phpMyAdmin.  I havent run across a host in recent times that doesnt give you access to phpMyAdmin in some form, so that&#8217;s what we&#8217;ll use here.</p>
<p>First, you&#8217;ll need to get into phpMyAdmin.  I can&#8217;t give you much help there, because it&#8217;s a different process with every host.  If you&#8217;re having trouble, get to your control panel, and just start searching for things &#8211; start with &#8220;phpMyAdmin&#8221;, but if you can&#8217;t find that, move on to &#8220;MySQL&#8221;, &#8220;Database&#8221; &#8211; things of that nature.  You&#8217;re bound to get on the right track soon enough.<br />
Once you&#8217;ve got phpMyAdmin opened up, you&#8217;ll end up at a screen that looks vaguely like this:<img src="http://yourcodegarage.com/blog/wp-content/uploads/2010/08/Screen-shot-2010-08-17-at-10.23.25-AM-600x471.png" alt="" title="Screen shot 2010-08-17 at 10.23.25 AM" width="600" height="471" class="aligncenter size-large wp-image-227" /></p>
<h2>Find your database</h2>
<p>On this main page, you&#8217;ve got a list of databases off to the left, and lots of information and settings you don&#8217;t need to worry about in the center.   You need to choose the database that is running the WordPress install in question off on that left column, and click to open it up. (If you&#8217;ve got a number of WordPress installs on one server, this could be a bit tricky.  Check out the settings in your wp-config.php file if random guessing doesn&#8217;t do the trick).</p>
<p>Now that you&#8217;ve chosen your database, you&#8217;ll see the list on the left has changed &#8211; now you&#8217;re looking at tables inside the chosen database instead of databases.  Click on the wp_posts table to open it (note &#8211; it&#8217;s possible that this is something other than wp_posts, especially if you&#8217;ve got multiple installs in one database.  The table you want will definitely end in &#8220;posts&#8221;, and whatever comes before that can be found in your wp-config.php file  &#8211; look for &#8220;$table_prefix = &#8220;).  Clicking on the posts table will either pull up a page describing the contents of the table, or an error message, that looks something like this:<br />
<img src="http://yourcodegarage.com/blog/wp-content/uploads/2010/08/crashed-600x121.png" alt="" title="crashed" width="600" height="121" class="aligncenter size-large wp-image-230" /></p>
<p>Surprisingly, this is good news.  Your precious posts are just one command away.  </p>
<h3>Repairing the table</h3>
<p>Finally, the juicy bits.  To repair the table, we&#8217;re going to need to run an SQL command on the database &#8211; and to do that, we&#8217;ll click the &#8220;SQL&#8221; tab near the top of the page.  Doing so should bring up a page with a box that looks something like this:<img src="http://yourcodegarage.com/blog/wp-content/uploads/2010/08/repair-600x135.png" alt="" title="repair" width="600" height="135" class="aligncenter size-large wp-image-232" /><br />
As shown in the screenshot, you need to enter this:</p>
<pre class="brush: sql">
repair table wp_posts;
</pre>
<p>In case you hadn&#8217;t guessed &#8211; if your table didnt start with wp_, you need to adjust that command accordingly.  </p>
<p>Double check that you&#8217;ve typed the command in properly, and hit &#8220;Go&#8221; (bottom right of the input box).  If all went well, a moment of loading later, you should be presented with this screen:<br />
<img src="http://yourcodegarage.com/blog/wp-content/uploads/2010/08/success-600x171.png" alt="" title="success" width="600" height="171" class="aligncenter size-large wp-image-233" /></p>
<p>And with that, you&#8217;re back in business.  Check your site, and your posts should be back.  In some cases, the wp_posts table isnt the only one that goes down, so as long as you&#8217;re in phpMyAdmin, you might double check to see if any of your other tables need some TLC from your newfound database administration skills.</p>
<p>On the off chance that none of this worked, the table wasn&#8217;t crashed, or repairing it didn&#8217;t fix the problem, there&#8217;s a fair chance you&#8217;re in serious trouble.  For problems with that, or any questions along the way, get in touch here, or <a href="mailto:peter@yourcodegarage.com/blog">drop me an email</a>.</p>
<p>Good luck!</p>
<p><strong>Update</strong> &#8211; All this post disappearing have you hankering for some backup help?  Have a look at this post about <a href="http://codesessions.net/2010/08/backing-up-your-wordpress-install-the-basics/">How to back up your WordPress blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2010/08/help-all-the-posts-have-disappeared-from-my-wordpress-site/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Display Properly Formatted Content From a $post Object in WordPress</title>
		<link>http://codegarage.com/blog/2009/05/how-to-display-properly-formatted-content-from-a-post-object-in-wordpress/</link>
		<comments>http://codegarage.com/blog/2009/05/how-to-display-properly-formatted-content-from-a-post-object-in-wordpress/#comments</comments>
		<pubDate>Fri, 22 May 2009 02:49:05 +0000</pubDate>
		<dc:creator>Peter</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Writing Plugins]]></category>
		<category><![CDATA[$post]]></category>
		<category><![CDATA[the_content]]></category>

		<guid isPermaLink="false">http://apartmentonesix.com/?p=185</guid>
		<description><![CDATA[Occasionally, I&#8217;ll run into a situation where I need to call a post specifically using the get_post() function.  get_post() returns a Post object, with a number of member variables &#8211; the one that stores the actual content of the post being post_content. However, if you try just echoing $post-&#62;post_content, you&#8217;ll get completely unformatted text &#8211; ...]]></description>
			<content:encoded><![CDATA[<p>Occasionally, I&#8217;ll run into a situation where I need to call a post specifically using the <a title="Wordpress get_post() codex page" href="http://codex.wordpress.org/Function_Reference/get_post" target="_blank">get_post()</a> function.  get_post() returns a Post object, with a number of member variables &#8211; the one that stores the actual content of the post being post_content.</p>
<p>However, if you try just echoing $post-&gt;post_content, you&#8217;ll get completely unformatted text &#8211; which is frustrating, because WordPress uses a great visual text editor on the backend &#8211; it&#8217;s a shame to not take advantage of it.  Fortunately, WordPress provides a filter to display the text just as it would be displayed in the the_content() function inside the loop.  Here&#8217;s how it works:</p>
<p>To get the content formatted properly, we need to apply a filter (which is different from adding a filter &#8211; here, we&#8217;re registering it so that other filter functions can modify it before it&#8217;s displayed).</p>
<pre class="brush: php">

apply_filters(&#039;the_content&#039;, $post-&gt;post_content);
</pre>
<p>So, we&#8217;re just applying the the_content filter to the $post-&gt;post_content variable.  Doing so means that any plugin which adds a filter function to the_content like this:</p>
<pre class="brush: php">

add_filter(&#039;the_content&#039;, &#039;my_content_manipulator&#039;);

function my_content_manipulator($content){

//do stuff here

return $content;

}
</pre>
<p>will be applied to your variable.  Fortunately, it also means that the WordPress core functions which format the post content correctly can also work on it.</p>
<p>Need more info about the $post object?  Check out this post: <a href="http://codegarage.com/blog/2011/09/the-wordpress-post-object-and-you/" title="The WordPress $Post Object and You"></a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://codegarage.com/blog/2009/05/how-to-display-properly-formatted-content-from-a-post-object-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

