Importing listings into the directory

Thought I would share how I did this.

I used this plugin: http://wordpress.org/extend/plugins/csv-importer/

I attached the csv file I created. Couple of things I learned:

the directory plugin creates a post type called directory_listing and that is the value in the csv_post_type column.

Any custom fields, whether or not you have created them: simply title a column by the custom field name and that field and value get added to the post.

The listing categories took a bit of trial and error. Though the import plugin doc does describe this, still couldn't quite get it, :slight_smile: The column heading I used : csv_ctax_listing_category. You need to specify the parent category name. So the value in my column was Food, Bakeries. Could also use the category slug AND you do not have to have already created the category. I had a spreadsheet value "Food, Fast Food" and the importer created the listing category.

The importer plugin created the post slugs automagically but you could put those in the spreadsheet as well.

I don't think I'm the first one to use this plugin but hopefully I can speed up someone else's implementation of this.

Lori

sorry couldn't attach the csv file: here is screenshot: screenshot

  • DavidM
    • DEV MAN’s Mascot

    Hi Lori,

    Many thanks for that, I really am sure this will be helpful to others, especially as we often link back to threads like this for reference!

    I'm curious though, as I haven't tried that particular plugin (I usually rely on TurboCSV), were you able to get everything imported from your spreadsheet into Directory?

    Thanks,
    David

  • Kruzen
    • The Incredible Code Injector

    Hi Lorilr, this looks like a great use to me.

    Just for clarification, in the field : csv_ctax_listing_category

    I see in your screenshot that it has a comma delimited value.

    So if I did something like

    Pants, Long, Denim

    would it auto create a parent category Pants, with a child category Long, with a child category Denim?

    Or at the very least.

    Pants, Long, would create a parent cateogyr Pants, with a child category Long?

  • Kruzen
    • The Incredible Code Injector

    @Lorilr

    I tried it out and I'm having an issue, maybe you can clarify

    My spreadsheet just has

    csv_post_title | csv_post_post | csv_post_type | csv_ctax_listing_category

    Title | PostInfo | directory_listing | Parent_A, Child_A
    Title1 | PostInfo | directory_listing | Parent_A, Child_B
    Title2 | PostInfo | directory_listing | Parent_A, Child_C

    This example loads in fine and will generate the Parent and child elements.

    However

    if I do this:

    Title | PostInfo | directory_listing | Parent_A, Child_A
    Title1 | PostInfo | directory_listing | Parent_A, Child_B
    Title2 | PostInfo | directory_listing | Parent_A, Child_C
    Title | PostInfo | directory_listing | Parent_B, Child_A
    Title1 | PostInfo | directory_listing | Parent_B, Child_B
    Title2 | PostInfo | directory_listing | Parent_B, Child_C

    So that the child elements are all exactly the same as the ones for Parent A, it only generates the ParentB, it won't make new child elements for the new parent category.

    Know of anyway around this?

  • lorilr
    • Design Lord, Child of Thor

    Hey

    I'm not sure I get what the issue is. Mine created Food, Fast Food AND Food, Mexican and .....

    The second pass it created all these categories:

    Misc
    Entertainment, Bowling
    Shopping, Shoes
    Services
    Shopping, Furniture
    Misc

    Are you saying that for you it would create Entertainment but not Shopping? Or Shoes but not furniture?

    Run the spreadsheet a second time and see if it creates them on the second pass.

    You can also ask for help on their forum or check out the $29 one David mentions above.

    Lori

  • Kruzen
    • The Incredible Code Injector

    Okay, I figured it out.

    It WAS creating each of them as it's supposed to, but it doesn't register them in wordpress until one of them is "touched" so you simply need to edit one of them and then they all show up.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.