<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.1" -->
<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/"
	>

<channel>
	<title>Mo Jebus &#187; WordPress</title>
	<link>http://moronicbajebus.com</link>
	<description>Banana Ice Cream!</description>
	<pubDate>Wed, 06 Aug 2008 14:30:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>
	<language>en</language>
			<item>
		<title>delete_post and deleted_post</title>
		<link>http://moronicbajebus.com/2007/10/11/delete_post-and-deleted_post/</link>
		<comments>http://moronicbajebus.com/2007/10/11/delete_post-and-deleted_post/#comments</comments>
		<pubDate>Thu, 11 Oct 2007 21:12:28 +0000</pubDate>
		<dc:creator>Seamus</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<category><![CDATA[Frontpage]]></category>

		<guid isPermaLink="false">http://moronicbajebus.com/2007/10/11/delete_post-and-deleted_post/</guid>
		<description><![CDATA[A little note for myself and anyone else.  I have not tested this yet but hopefully I will soon.
From my snooping, Wordpress 2.2.x has a new hook and has changed a hook. Before 2.2, the delete_post hook was called after the post was deleted. With 2.2, delete_post hook is call before the post is [...]]]></description>
			<content:encoded><![CDATA[<p>A little note for myself and anyone else.  I have not tested this yet but hopefully I will soon.</p>
<p>From <a href="http://trac.wordpress.org/browser/branches/2.2/wp-includes/post.php#L407">my</a> <a href="http://trac.wordpress.org/browser/branches/2.2/wp-includes/post.php#L438">snooping</a>, Wordpress 2.2.x has a new hook and has changed a hook. Before 2.2, the <code>delete_post</code> hook was called <em>after</em> the post was deleted. With 2.2, <code>delete_post</code> hook is call <em>before</em> the post is deleted whereas a new hook <code>deleted_post</code> is called after the post is deleted. In all the cases, the hook function is passed the post ID.</p>
<p>This is very good because originally you would be out of luck if you needed information (date, slug, etc) about the deleted post. Now you can grab the information, based upon the ID, before the post is deleted from the database.</p>
]]></content:encoded>
			<wfw:commentRss>http://moronicbajebus.com/2007/10/11/delete_post-and-deleted_post/feed/</wfw:commentRss>
		</item>
		<item>
		<title>From TypePad to WordPress with Slugs</title>
		<link>http://moronicbajebus.com/2006/11/17/from-typepad-to-wordpress-with-slugs/</link>
		<comments>http://moronicbajebus.com/2006/11/17/from-typepad-to-wordpress-with-slugs/#comments</comments>
		<pubDate>Fri, 17 Nov 2006 20:13:57 +0000</pubDate>
		<dc:creator>Seamus</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<category><![CDATA[Frontpage]]></category>

		<guid isPermaLink="false">http://moronicbajebus.com/?p=104</guid>
		<description><![CDATA[As this post is already fairly long in length, I did not go into every detail.  Such as, I omit how to set your permalinks to match TypePad and how to make an MySQL query.  I hope this post helps someone out there.
Although WordPress has a built-in import feature for TypePad/Movable Type, it [...]]]></description>
			<content:encoded><![CDATA[<p><em>As this post is already fairly long in length, I did not go into every detail.  Such as, I omit how to set your <a href="http://codex.wordpress.org/Using_Permalinks">permalinks</a> to match TypePad and <a href="http://www.webdevelopersnotes.com/tutorials/sql/index.php3">how</a> to <a href="http://www.phpmyadmin.net/home_page/index.php">make</a> an MySQL query.  I hope this post helps someone out there.</em></p>
<p>Although WordPress has a built-in import feature for TypePad/Movable Type, it does not import the slugs.  (The slug is the post name formated for the <span class="caps">URL</span> for example a post titled &#8220;I Love Cheese&#8221; has a slug of &#8220;i-love-cheese&#8221; in WordPress.) The slugs are not export by TypePad nor import by WordPress. So WordPress creates new slugs for each post in the WordPress style. The three issues with this are:</p>
<ol>
<li>TypePad uses the underscore &#8221;_&#8221; to separate words whereas WordPress uses the dash &#8221;-&#8221; </li>
<li>TypePad truncates the slug to 15 characters whereas WordPress does not</li>
<li>TypePad will keep slugs that are not the same as the title</li>
</ol>
<p>The first and second can be easily be fixed with a little bit of <span class="caps">SQL</span> on the database.  But since the last one requires that you know explicitly the slug in TypePad, a modified import process needs to be done. </p>
<p><em><strong>(These steps require that you do not have any post in your WordPress installation.)</strong></em></p>
<h2>The Modified Import Process</h2>
<h3>Exporting From TypePad</h3>
<p>The first step is to get an export from TypePad with the slugs included. Adam Stiles has <a href="http://adamstiles.com/2005/10/painless_switch_from_typepad_to_wordpress/">created</a> a <a href="http://adamstiles.com/mt_export_with_name.txt">Movable Type template</a> for this purpose . I did have to modify it to get all (actually about the last five years which all the post are within) the posts instead of the last 100. </p>
<p>Original:<br />
<code>&lt;MTEntries lastn="100"&gt;</code></p>
<p>Modified:<br />
<code>&lt;MTEntries days="1780"&gt;</code></p>
<p><em>Please note that this will only export posts which are published. Drafts will not be exported.</em></p>
<p>Save and publish the template as an Index Template. Then view the generate published file and save it to your computer.</p>
<h3>Importing Into WordPress</h3>
<p>The second step is to import the exported posts into WordPress.  The default WordPress import will not import the slugs.  In order to also bring in slugs, you will need to use Adam Stiles Movable Type importer. </p>
<ol>
<li>You must already have WordPress installed and configured.</li>
<li>Upload the export posts file to your WordPress installation&#8217;s wp-admin directory.</li>
<li>Download the <a href="http://adamstiles.com/import-mt-with-name.phps">MovableType importer</a> and save as import-mt.php.</li>
<li>Edit import-mt.php to include the name of the export file. For example if your export file was named export.txt, then modify the second line as such &#8220;<code>define('MTEXPORT', 'export.txt');</code>&#8221;.</li>
<li>Upload import-mt.php to your WordPress installation&#8217;s wp-admin directory.</li>
<li>Run, through your web browser, import-mt.php in your WordPress installation. <em>(The first page that shows up is not an error, but just a message stating you must edited, which you have, &#8220;<code>define('MTEXPORT', '');</code>&#8221; before moving to the next step.)</em></li>
</ol>
<h3>Trim Excess Off Slugs With <span class="caps">SQL</span></h3>
<p><em>(This part of the process assumes that no posts existed in your WordPress installation before you imported the TypePad post into WordPress. Although, I am sure you can still trim the desired posts with <span class="caps">SQL</span> code which targets the desired posts.) </em></p>
<p>The imported slugs are not the actually slugs; instead, they are the relative <span class="caps">URL</span> paths which happen to include the slugs. To get the proper slugs we will trim the excess. For this case, the format is &#8221;/YYYY/MM/SLUG.html&#8221;.  A simple MySQL query can trim this (I did this in phpMyAdmin):</p>
<p><code>UPDATE &lt;WORDPRESS TABLE PREPEND&gt;_posts SET post_name = INSERT( INSERT(post_name, LOCATE('.html', post_name), 5, ''), 1, 9, '' ) WHERE 1</code></p>
<p>The break down of the query</p>
<ul>
<li><code>&lt;WORDPRESS TABLE PREPEND&gt;</code> is the value you prefixed your database tables with during the configuration (the default is &#8220;wp&#8221;).</li>
<li>The query will update every record (every post). To target posts you will need, at the least, to modify <code>WHERE 1</code>. </li>
<li><code>post_name</code> is the post slug field.</li>
<li><a href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#id3017539">INSERT</a> <code>( str, pos, length, repstr)</code> is a MySQL function we are using to &#8220;erase&#8221; part of the string we do not want.</li>
<li><a href="http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#id3018093">LOCATE</a> <code>('.html', post_name)</code> returns the starting position of &#8221;.html&#8221; is post_name.</li>
<li><code>INSERT(post_name, LOCATE('.html', post_name)</code> returns a string of &#8221;/YYYY/MM/SLUG&#8221; which means we erased &#8221;.html&#8221;.</li>
<li><code>INSERT( INSERT(post_name, LOCATE('.html', post_name), 5, ''), 1, 9, '' )</code> returns a string &#8220;SLUG&#8221; which means we erased &#8221;/YYYY/MM/&#8221;.</li>
</ul>
<p>Finally, the imported post have their respected original slugs. Which will make it far easier to mimic the <span class="caps">URL</span> structure of the TypePad individual archives with WordPress.</p>
]]></content:encoded>
			<wfw:commentRss>http://moronicbajebus.com/2006/11/17/from-typepad-to-wordpress-with-slugs/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Auto-Close Comments</title>
		<link>http://moronicbajebus.com/2005/12/10/auto-close-comments/</link>
		<comments>http://moronicbajebus.com/2005/12/10/auto-close-comments/#comments</comments>
		<pubDate>Sat, 10 Dec 2005 17:51:13 +0000</pubDate>
		<dc:creator>Seamus</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://moronicbajebus.com/wordpress/2005/12/10/auto-close-comments/</guid>
		<description><![CDATA[A little WordPress plugin to disable comments for old post.
]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://wiki.wordpress.org/?pagename=Auto%20shutoff%20comments">little WordPress plugin</a> to disable comments for old post.</p>
]]></content:encoded>
			<wfw:commentRss>http://moronicbajebus.com/2005/12/10/auto-close-comments/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
