Thursday, May 17, 2012

Importing Joomla articles to WordPress posts

Migrating the articles:
  1. Change database name my_joomla_db to your joomla database and my_wordpress_db to your Wordpress database
  2. Change http://demo.joellipman.com/wordpress/ to the full URL of your WordPress site.
  3. If post_type is to be post then append with ?p= otherwise use ?page_id=.
Articles:
------ MIGRATING JOOMLA v1.5.# CONTENT TO WORDPRESS v3.2.# ------
-----------------------------------------------------------------

INSERT INTO my_wordpress_db.wp_posts
SELECT
	id 'ID',
	1 'post_author',
	created 'post_date',
	created 'post_date_gmt',
	CONCAT(introtext, ' ', `fulltext`) 'post_content',
	title 'post_title',
	'' post_excerpt,
	CASE state WHEN '1' THEN 'publish' ELSE 'draft' END 'post_status',
	'open' comment_status,
	'open' ping_status,
	'' post_password,
	alias 'post_name',
	'' to_ping,
	'' pinged,
	modified 'post_modified',
	modified 'post_modified_gmt',
	'' post_content_filtered,
	'0' post_parent,
	CONCAT('http://demo.joellipman.com/wordpress/', '?p=', id) AS guid,
	'0' menu_order,
	'post' AS 'post_type',
	'' post_mime_type,
	0 comment_count
FROM
	my_joomla_db.jos_content
ORDER BY
	id


Importing the joomla categories to Wordpress: (still to do: sections as parent categories?)

SET @CountCategoriesAlreadyEntered:=(SELECT MAX(term_id) FROM my_wordpress_db.wp_terms);

INSERT INTO my_wordpress_db.wp_terms
SELECT
	(a.id + @CountCategoriesAlreadyEntered) 'term_id',
	a.title 'name',
	a.alias 'slug',
	0 'term_group'
FROM
	my_joomla_db.jos_categories a
ORDER BY
	a.id;


INSERT INTO my_wordpress_db.wp_term_taxonomy
SELECT
	(a.id + @CountCategoriesAlreadyEntered) 'term_taxonomy_id',
	(a.id + @CountCategoriesAlreadyEntered) 'term_id',
	'category' AS 'taxonomy',
	a.description 'description',
	0 'parent',
	(SELECT COUNT(c.id) FROM my_joomla_db.jos_content c WHERE c.catid=a.id) 'count'
FROM
	my_joomla_db.jos_categories a
ORDER BY
	a.id;	


INSERT INTO my_wordpress_db.wp_term_relationships
SELECT
	b.id 'object_id',
	(b.catid + @CountCategoriesAlreadyEntered) 'term_taxonomy_id',
	0 'term_order'
FROM
	my_joomla_db.jos_content b
ORDER BY
	b.id;	
Importing Joomla jComments to Wordpress Posts:

...still to come...

Add comment

Please note: all comments are reviewed before being published.


Security code
Refresh

Member Login

Joes Latest Members

A huge WELCOME goes to today's newest members:

  • infonat
Member Signups (Activated)
BeforeCurrentTrend
Day21=
Week105ê
Month11224ê
Year2,265612ê

Member Stats
56 guests are currently online.
1,178 members are still deciding.
There are 5,935 members in total.

Latest Comments

Paypal Donations

Want to support my work? Any donation is a blessing :c)