Looking for advice for the best method to accomplish the following.
I have a custom page template with several custom fields/taxonomy.
The data needed for these custom fields actually resides in .txt files that are updated once a week. They are easily converted into .csv files. What would be the best and most secure method in getting this data into a custom page template, I figure I have 3 options.
Read the raw .txt or .csv files using custom php?
Import the .csv into a separate database and grab the data from it?
Import the data into the WordPress database?
Option 3 seems to be the best one, but I am completely unfamiliar with the wordpress database structure and the best way to go about this.
Unlikely that you will need intermediary database, from your description this is likely to be easy enough with bit of PHP and WP APIs.
Create WP-Cron task (if you need automated recurrent import).
Read data from flat files, for example with
fgetcsv()
.Use
wp_insert_post()
for creating posts and custom field functions to add your data. This was recently covered in detail in WP insert post PHP function and Custom Fields question.