Import CSV

This topic contains 4 reply and 2 voices, and was last updated by noomia 11 years ago
Viewing 4 Posts - 1 through 4 (of 4 total)
Author Posts
April 19, 2013 at 8:36 am 2530
noomia Hi Tareq, I have a custom post type called "companies". I have created a few custom fields with your plugin. Now, I have a .csv file with 150 companies. I need to import them and map the custom fields with the right value in the csv. How could I do this ? Thanks !
April 19, 2013 at 10:49 am 2538
Tareq Hasan Tareq Hasan

You can use just raw PHP to read the CSV files. Then run a loop and use wp_insert_post() to insert those companies and use update_post_meta() to associate those values in right custom fields.

April 19, 2013 at 11:17 am 2541
noomia noomia

Ouch… It seems to be difficult to me… Could you please give me a small example 🙂 ?

I’ve tried with the plugin : WP Ultimate CSV Importer. I was allowed to choose the custom post type and allowed to map my csv cells with the good custom field (for example : “CF:address”). It creates my company but only with post_title and post_content, nothing else.

After that I’ve seen that the plugin allow to assign a cell to a custom field with let me assign the name of the field. I have tried with “address” instead of the suggested “CF:address” and it works well.

But I still have a problem. I’ve checked in WPUF settings to “Show custom fields on post content area”. So normally on a single company page, it has to list the custom fields, but it doesn’t ! When I edit one of these companies, I have to chose the “WPUF Form”, then update the post, and finally it works. But as I said, I have 150 companies and don’t want to edit each one by one.

So when I import my companies, do I have to assign a value to a specific field to let it know that it has to use the right form ?

Thank you very much !

April 19, 2013 at 11:36 am 2545
Tareq Hasan Tareq Hasan

Yes, every post needs to assign a custom field `_wpuf_form_id` with the required form ID.

April 19, 2013 at 3:01 pm 2556
noomia noomia

It works 🙂 Thanks !

Viewing 4 Posts - 1 through 4 (of 4 total)