Thread Starter
myagci
(@myagci)
Please note I’m now featuring the example in a new address.
Hi there,
Love what you’ve come up with here, and would love to adapt it.
It is possible to import values for custom fields with this technique?
What about multiple categories?
Thanks for your thoughts
Thanks for sharing this! Can’t wait to experiment with this technique, although, like travelvice, I’ll need to figure out how to get custom fields working in order for it to prove useful.
I’ve figured this out.
This is an example of a bare-bones XML file that you can import using the WORDPRESS option, which will give you access to all sorts of neat scheme options:
<item>
<title>Study Abroad in Venezuela</title>
<category><![CDATA[Venezuela]]></category>
<category><![CDATA[Studying Abroad]]></category>
<content:encoded><![CDATA[<p>Information on studying abroad in Venezuela.</p>]]></content:encoded>
<wp:postmeta>
<wp:meta_key>description</wp:meta_key>
<wp:meta_value>Studying Abroad in Venezuela - Where and how to study abroad in Venezuela</wp:meta_value>
</wp:postmeta>
</item>
In this particular example, the item inserted is flagged as a DRAFT so that it can be reviewed, then published. It tosses in a title, 2 categories, body content, and a custom field called ‘description’.
The line breaks are required.
Simply make Excel fill in the values for these, dump the cells into a text file, save with an .XML extension, and import. BOOM.
I just did 244 entries in a few minutes — amazing. No nasty SQL or table inserts.
To see what other options you have, simply look at the results of an EXPORT from the MANAGE admin menu in notepad.
WordPress is very forgiving, and you don’t need ANYTHING except the above — no XML header or footer information.
Good luck!
//craig, travelvice.com
Just successfully imported my first two test posts with custom fields using Craig’s method.
Thanks again for the concept myagci and especially for the update, Craig.
I’m using WordPress as a DAM, which means I rely heavily on custom fields containing filenames that, as a general rule, increase numerically. I can’t even guess how much time this technique might save me down the road.
You’re welcome Tyler! I’m very excited myself.
Another neat trick that I picked up before this was developed was that you can enter a comma separated string of category names on the post creation screen and hit the ADD button, and it will automatically check the categories that match those names — it doesn’t duplicate existing entries.
Good luck to all
Oh shit..this looks promising for me.
Can other fields like the date/time be added to this ? I have to import about a year’s worth of data. They’re already in excel. But i need them dated correctly.
How can i include options of date and image links?
Hi,
thanks for the code and idea above!
One more question:
I use the following xml and it works great but the custom field is not added to the post.
Any ideas?
<item>
<pubDate>15 February 2008 00:00:00 +0001</pubDate>
<title>rin</title>
<description>easy</description>
<category>Adrian</category>
<category>rings</category>
<postmeta>
<meta_key>observer</meta_key>
<meta_value>m</meta_value>
</postmeta><
/item>
@micharo: I think for the tags you’re missing <wp:>
so for instance, it should be
<wp:postmeta>
rather than
<postmeta>
<item>
<pubDate>15 February 2008 00:00:00 +0001</pubDate>
<title>rin</title>
<description>easy</description>
<category>Adrian</category>
<category>rings</category>
<wp:postmeta>
<wp:meta_key>observer</wp:meta_key>
<wp:meta_value>m</wp:meta_value>
</wp:postmeta><
/item>
its not working with custom field.
i used the rc:custom_field_gui plugin for the custom field.
pls someone help me.
thanks.
Nice!
I have one problem though. I am trying to import posts into sub-categories and I am having issues….
I can import to a category without any problem but I can’t figure out the import to a subcategory.
I unsuccessfully tried the following:
<wp:category><wp:category_parent>Yoga Classes</wp:category_parent><wp:cat_name><![CDATA[Test Yoga Classes - TE]]></wp:cat_name></wp:category>
It creates the post and it creates the subcategory but it won’t put the post in this subcategory. I just puts the post in “uncategorized”.
Your help on this would be greatly appreciated.
Thanks
Import into Parent Category > Then Make Parent category a sub category
maybe this is a very stupid question but how do you export the data from excel with the replaced values in it , when I paste the formula formula from myagci in excel the values don’t change, either the formula is not working or I am doing something wrong
How can I set this up so it imports as a page, not a post? I’ve successfully added 300 posts in one import, but I need to do it for pages AND set a custom template at the time of import.
Thanks!
Michael
I tried this:
<item><title>Page Name</title><wp:post_type>page</wp:post_type><wp:postmeta>
<wp:meta_key>_wp_page_template</wp:meta_key>
<wp:meta_value>support.php</wp:meta_value>
</wp:postmeta>
</item>
But it still got imported as a Post.