<?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>Not Just a Hat Rack &#187; Wordpress</title>
	<atom:link href="http://notjustahatrack.com/posts/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://notjustahatrack.com</link>
	<description>Development, design, etc.</description>
	<lastBuildDate>Mon, 18 Apr 2011 16:05:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>Removing Extraneous WordPress Tags</title>
		<link>http://notjustahatrack.com/posts/remove-extraneous-wordpress-head-tags/</link>
		<comments>http://notjustahatrack.com/posts/remove-extraneous-wordpress-head-tags/#comments</comments>
		<pubDate>Tue, 29 Jul 2008 02:20:18 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://notjustahatrack.com/?p=20</guid>
		<description><![CDATA[In an effort to streamline my site&#8217;s code, I&#8217;m attempting to remove any and all elements that aren&#8217;t absolutely necessary for the majority of my audience (standards compliant visual user agents). WordPress adds some tags by default at the top of each page that I won&#8217;t need by way of the wp_head function call. The [...]]]></description>
			<content:encoded><![CDATA[<p>In an effort to streamline my site&#8217;s code, I&#8217;m attempting to remove any and all elements that aren&#8217;t absolutely necessary for the majority of my audience (standards compliant visual user agents).  WordPress adds some tags by default at the top of each page that I won&#8217;t need by way of the <code>wp_head</code> function call.  The most extensible and efficient method to remove the tags was to write a plugin, which you can download and drop in your <code>wp-content/plugins/</code> directory:<span id="more-20"></span></p>
<p><a href="/lib/scripts/less-head.php">Less Head Plugin</a></p>
<p>The <code>wp_head</code> function is a WordPress <a href="http://codex.wordpress.org/Plugin_API">action hook</a>.  There are several functions defined in the <code>wp-includes/general-template.php</code> that are then added as WordPress <a href="http://codex.wordpress.org/Plugin_API#Actions">actions</a> in the <code>wp-includes/default-filters.php</code> file.  Here&#8217;s the code in the <code>default-filters.php</code> file that adds them as actions:</p>
<pre><code>
add_action('wp_head', 'rsd_link');
add_action('wp_head', 'wlwmanifest_link');
add_action('wp_head', 'wp_generator');
</code></pre>
<p>So we could comment out or delete these declarations, but that might cause an issue when we upgrade the WordPress install.  Instead all we have to do is remove these actions in our plugin:</p>
<pre><code>
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
</code></pre>
<p>Finally, you may be curious as to what exactly these tags are for and why WordPress includes them by default:</p>
<ul>
<li>The RSD link refers to a <a href="http://en.wikipedia.org/wiki/Really_Simple_Discovery">Really Simple Discovery</a> file, an XML format developed to make it easier for some software to interact with your blog.  May be important if RSD becomes more prevalent, but for the time being I am OK with removing it.</li>
<li>The wlwmanifest link references a file that is needed for Windows Live Writer interaction.  I don&#8217;t use Windows Live Writer.</li>
<li>The wp_generator function prints a tag displaying your version of WordPress.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://notjustahatrack.com/posts/remove-extraneous-wordpress-head-tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Development Environment for WordPress-Driven Sites</title>
		<link>http://notjustahatrack.com/posts/initial-development-environment-for-wordpress-driven-sites/</link>
		<comments>http://notjustahatrack.com/posts/initial-development-environment-for-wordpress-driven-sites/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 15:47:13 +0000</pubDate>
		<dc:creator>andrew</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://notjustahatrack.com/?p=7</guid>
		<description><![CDATA[Creating a good development environment is obviously very important for any new development project, and with database-driven applications, it&#8217;s often a hassle to keep files and data in sync. With this in mind, I tried to come up with an efficient method of pushing a local development copy of this site to its live server. [...]]]></description>
			<content:encoded><![CDATA[<p>Creating a good development environment is obviously very important for any new development project, and with database-driven applications, it&#8217;s often a hassle to keep files <em>and</em> data in sync.  With this in mind, I tried to come up with an efficient method of pushing a local development copy of this site to its live server.<span id="more-7"></span></p>
<h3>The Development Environment</h3>
<p>The production environment for the project runs on LAMP (Linux, Apache, MySQL and PHP), and uses WordPress for the blog / CMS duties.  LAMP and WordPress are a snap to set up on OS X and Windows, so I won&#8217;t go into the details here.  For Windows, you can even install a self-contained and self-installing package with all of the technologies, like <a href="http://www.apachefriends.org/en/xampp.html">XAMPP</a>.  If you need help, check google for current instructions.</p>
<h3>Synching the Files</h3>
<p>In the initial stages of development, it&#8217;s common to a multitude of changes throughout the site, and as such it can be inefficient to use simple FTP for pushing changes live.  I was looking for an easy way to instantly sync the development and production servers, and I wasn&#8217;t worried about version control or multiple developers have access to the same code.  If I was, I could have used <a href="http://subversion.tigris.org/">Subversion</a>, but that seemed a little too much for this simple task.  </p>
<p>So instead, I used <a href="http://samba.anu.edu.au/rsync/">rsync</a> over SSH:</p>
<pre><code>
rsync -rve ssh [mylocaldirectory]  [myuser]@[myserver]:[myremotedirectory] --exclude-from=[exclude-file]
</code></pre>
<p>&#8230; and stored the command in a file named <code>update-files.sh</code> so I could execute it whenever I needed to.  You&#8217;ll have to enter your SSH password when you run it, but it&#8217;s considerably more secure this way. Some notes on the command:</p>
<ul>
<li><code>-r</code> makes it recursive (obviously need that)</li>
<li><code>-v</code> makes it verbose (helpful)</li>
<li><code>-e</code> allows you to include a remote shell</li>
<li><code>--exclude-from</code> allows you to specify an exclude file with patterns to ignore in the transfer.  This is helpful because you can exclude domain specific configuration files, <code>.DS_Store files</code>, etc.  Just make a separate file, and include filenames / patterns to ignore one to each line.</li>
</ul>
<p>That&#8217;s it!  In this example you&#8217;ll need remote shell access via ssh, which may be difficult to obtain if you run on a shared host.  If you run into problems you can use rsh or run a rsync server&#8230; check the  rsync man page for more details.</p>
<p>You&#8217;ll also need access to a Unix / Linux command line, which isn&#8217;t a problem for Mac users.  For Windows users, get <a href="http://www.cygwin.com/">Cygwin</a>.</p>
<h3>Synching the Database</h3>
<p>Given the nature of WordPress, to maintain a similar copy of the database across domains would basically require:</p>
<ul>
<li>Backing up the database to be moved</li>
<li>Copying the database backup to the other domain</li>
<li>Restoring the database backup on the other domain</li>
<li>Replacing the domain specific mentions in the WordPress DB</li>
</ul>
<p>Fortunately, all this is easily scripted.  I used two files, first, on my local (development) machine, I created a file named <code>update-db.sh</code>:</p>
<pre><code>
mysqldump -u [db_user] -p [db_password] [db_name] > current.sql
ftp ftp://[username]:[password]@[remote_domain] <<**
cd updater
put current.sql
exit
**
ssh [username]@[domain] 'updater/update-my-db.sh'
</code></pre>
<p>Breaking it down:</p>
<pre><code>
mysqldump -u [db_user] -p [db_password] [db_name] > current.sql
</code></pre>
<p>Dumps the current development database to a .sql file.</p>
<pre><code>
ftp ftp://[username]:[password]@[remote_domain] <<**
cd updater
put current.sql
exit
**
</code></pre>
<p>Connects via ftp, moves into the updater directory and transfers the sql backup.</p>
<pre><code>
ssh [username]@[domain] 'updater/update-my-db.sh'
</code></pre>
<p>Connects via ssh to the remote shell, and executes <code>update-my-db.sh</code>, which should look like this:</p>
<pre><code>
mysql --user=[db_user] --password=[db_password] [db] < ~/updater/current.sql;
mysql -e "UPDATE wp_options SET option_value = '[live domain]' WHERE option_name = 'home'" --user=[db_user] --password=[db_password] [db]
mysql -e "UPDATE wp_options SET option_value = '[live domain + path to wordpress' WHERE option_name = 'siteurl'" --user=[db_user] --password=[db_password] [db]
mysql -e "UPDATE wp_posts SET guid = REPLACE (guid,'[local domain]','[live domain]')" --user=[db_user] --password=[db_password] [db]
exit
</code></pre>
<p>This file needs to be on the remote machine so it can interact with mysql.  Basically, it takes the domain-specific mentions and changes them to point to the live server instead of the development one.</p>
<p>And that's it!  Just run <code>update-db.sh</code> on your development machine and any WordPress changes (posts, pages, options, etc.) should be replicated on the live server.</p>
]]></content:encoded>
			<wfw:commentRss>http://notjustahatrack.com/posts/initial-development-environment-for-wordpress-driven-sites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

