Skip to content

Instantly share code, notes, and snippets.

@carstingaxion
Created July 8, 2012 12:05
Show Gist options
  • Save carstingaxion/3070665 to your computer and use it in GitHub Desktop.
Save carstingaxion/3070665 to your computer and use it in GitHub Desktop.
ExpressionEngine to WordPress Export Template
<?xml version="1.0" encoding="UTF-8" ?>
<!-- To import this information into a WordPress site follow these steps: -->
<!--RUN THIS FILE IN FIREFOX OR IE-->
<!--VIEW PAGE SOURCE-->
<!--COPY-PASTE PAGE SOURCE INTO TEXT EDITOR AND SAVE AS .WXR FILE-->
<!--REMOVE "?'s" FROM XML VERSION AT TOP OF THIS PAGE-->
<!--COMMENT OUT LINE 1309, 1310, 1311 IN wp-includes/kses.php -->
<!--THEN FOLLOW THE STEPS BELOW-->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->
<!-- 4. Activate & Run Importer. -->
<!-- 5. Upload this file using the form provided on that page. -->
<!-- 6. You will first be asked to map the authors in this export file to users -->
<!-- on the site. For each author, you may choose to map to an -->
<!-- existing user on the site or to create a new user. -->
<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
<!-- contained in this file into your site. -->
<!-- generator="WordPress/3.1.2" created="2011-07-09 05:45" -->
<rss version="2.0"
xmlns:excerpt="http://wordpress.org/export/1.1/excerpt/"
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:wp="http://wordpress.org/export/1.1/"
>
<channel>
<title>{site_name}</title>
<link>{site_url}</link>
<description></description>
<pubDate></pubDate>
<language>de</language>
<wp:wxr_version>1.1</wp:wxr_version>
<wp:base_site_url>http://pixelfans.wp/</wp:base_site_url>
<wp:base_blog_url>http://pixelfans.wp</wp:base_blog_url>
<generator>http://wordpress.org/?v=3.1.2</generator>
{exp:weblog:entries weblog="YOUR-WEBLOG-NAME" orderby="date" sort="desc" limit="100000" offset="0" rdf="off" status="open|draft|reviewed|published|closed"}
<item>
<title>{exp:xml_encode}{title}{/exp:xml_encode}</title>
<link></link>
<pubDate>{entry_date format="%r"}</pubDate>
<dc:creator><![CDATA[{author}]]></dc:creator>
<guid isPermaLink="false">http://pixelfans.wp/?p={entry_id}</guid>
<description></description>
<content:encoded><![CDATA[{if body}{body}{/if}{if extended}{extended}{/if}]]></content:encoded>
<excerpt:encoded><![CDATA[<?php echo ("{summary}") ? strip_tags("{summary}") : ''; ?>]]></excerpt:encoded>
<wp:post_id></wp:post_id>
<wp:post_date>{entry_date format="%Y-%m-%d %H:%i:%s"}</wp:post_date>
<wp:post_date_gmt>{gmt_date format="%Y-%m-%d %H:%i:%s"}</wp:post_date_gmt>
<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>
<wp:post_name>{url_title}</wp:post_name>
<wp:status>{if status == "open"}publish{if:elseif status == "review"}pending{if:elseif status == "closed"}private{if:elseif status == "draft"}draft{if:else}draft{/if}</wp:status>
<wp:post_parent>0</wp:post_parent>
<wp:menu_order>0</wp:menu_order>
<wp:post_type>post</wp:post_type>
<wp:post_password></wp:post_password>
<wp:is_sticky>0</wp:is_sticky>
{categories}
<category domain="category" nicename="{if category_url_title == "uncategorized"}media{if:else}{category_url_title}{/if}"><![CDATA[{if category_name == "Uncategorized"}Media{if:else}{category_name}{/if}]]></category>
{/categories}
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value><![CDATA[1]]></wp:meta_value>
</wp:postmeta>
{if article_links}
<wp:postmeta>
<wp:meta_key>Associated Links</wp:meta_key>
<wp:meta_value><![CDATA[{article_links}]]></wp:meta_value>
</wp:postmeta>
{/if}
<wp:postmeta>
<wp:meta_key>_su_rich_snippet_type</wp:meta_key>
<wp:meta_value><![CDATA[none]]></wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_encloseme</wp:meta_key>
<wp:meta_value><![CDATA[1]]></wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_ee_post_id</wp:meta_key>
<wp:meta_value><![CDATA[{entry_id}]]></wp:meta_value>
</wp:postmeta>
{exp:comment:entries sort="asc" entry_id="{entry_id}" dynamic="no"}
<?php
$sql = "SELECT * FROM exp_comments WHERE comment_id = {comment_id}";
$dblink = mysql_connect( "SERVER", "USER", "PASSWORD" );
mysql_select_db( "DATABASE", $dblink );
$result = mysql_query( $sql, $dblink );
while ($row = mysql_fetch_object($result)) {
?>
<wp:comment>
<wp:comment_id>{comment_id}</wp:comment_id>
<wp:comment_author><![CDATA[{name}]]></wp:comment_author>
<wp:comment_author_email><?php echo $row->email; ?></wp:comment_author_email>
<wp:comment_author_url><?php echo $row->url; ?></wp:comment_author_url>
<wp:comment_author_IP><?php echo $row->ip_address; ?></wp:comment_author_IP>
<wp:comment_date>{comment_date format="%Y-%m-%d %h:%i:%s"}</wp:comment_date>
<wp:comment_date_gmt>{gmt_comment_date format="%Y-%m-%d %h:%i:%s"}</wp:comment_date_gmt>
<wp:comment_content><![CDATA[<?php echo mb_convert_encoding( $row->comment, 'UTF-8'); ?>]]></wp:comment_content>
<wp:comment_approved>1</wp:comment_approved>
<wp:comment_type>{if status == "trackback"}trackback{if:else}comment{/if}</wp:comment_type>
<wp:comment_parent>0</wp:comment_parent>
<wp:comment_user_id><?php echo $row->author_id; ?></wp:comment_user_id>
<?php if ( !empty( $row->notify ) ) : ?>
<wp:commentmeta>
<wp:meta_key><![CDATA[_ee_notify]]></wp:meta_key>
<wp:meta_value><![CDATA[<?php echo $row->notify; ?>]]></wp:meta_value>
</wp:commentmeta>
<?php endif; ?>
<?php if ( !empty( $row->location ) ) : ?>
<wp:commentmeta>
<wp:meta_key><![CDATA[_ee_location]]></wp:meta_key>
<wp:meta_value><![CDATA[<?php echo $row->location; ?>]]></wp:meta_value>
</wp:commentmeta>
<?php endif; ?>
</wp:comment>
<?php
} // endwhile // mysql_fetch_object()
mysql_free_result($result);
?>
{/exp:comment:entries}
</item>
{/exp:weblog:entries}
</channel>
</rss>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment