Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I don't know where to start with this one.

I would like to create custom post type which will list properties on clients website. I would like those properties being feed from another website/software. So other website/software will be sending XML file to my Wordpress site and I would like to receive that file and convert it to my custom posts.

Could anyone help me to get my head around this task, i.e. where to start? Do I need to create custom table in my database? How do I capture that XML file? Any info would be much appreciated.

Thanks

share|improve this question
add comment

2 Answers 2

I made such a script for our own company.

My case:

I needed a script that imported a list of XML files and made a post for every row in the file.

What I did:

  • I made a CPT in wich I stored feed information
  • In a script I created a XML import wich makes a post for every row
  • The script was put in a cronjob that runs once a day to refresh the data

My code:

Here's my code: http://pastebin.com/NAhspY20 (will expire in 30 days)

It wont be entirely what you are searching for, but I hope it will give you an idea of where to start.

share|improve this answer
    
Can you post your code in your answer? Answers last a lot longer than pastebins 30 days. You may also want to try a more persistent service, I use gist.github.com but you might now others –  Tom J Nowell Apr 7 at 22:54
add comment

Fetching the data

To fetch your posts, you'd utilize the HTTP_API, fetch_feed() or SimplePie. This completely depends on how and from where you're going to get the XML.

Here's one answer about the HTTP API](http://wordpress.stackexchange.com/a/73659/385) and another one.

Storing & maintaining the data

The main problem will be that you need a storage location. Therefore you'd go and set up a Custom Post Type and maybe some Custom Taxonomies as well. Just make sure that they're properly registered to each other. The tough part will be inserting, updating and deleting the post data, meta data, authors and taxonomies terms.

Retrieving the data on interval

Normally you'd utilize the Transient API and/or the Schedule/Cron API.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.