[ad_1]
Hi I have an old website that i am restarting in WordPress
We have maybe 100 newsletters and stuff (PDFs, PPTx).
I’d like each of the newsletter or file to be a sperate news/blog Post, and it can just be displayed directly on that post.
Is there a way to create this in a batch process if i have a CSV like:
Title,FileName,DateCreated
hope my question made sense
Thanks
[ad_2]
Yes, WP All Import does this.
Assuming your CSV is in the format of title,date,content you could do something like this:
if (($handle = fopen(‘./path-to-file.csv’, ‘r’)) !== FALSE) {
while (($row = fgetcsv($handle, 0)) !== FALSE) {
$new_post_data = [
‘post_title’ => $row[0],
‘post_date’ => $row[1],
‘post_content’ => $row[2],
];
wp_insert_post($new_post_data);
}
fclose($handle);
}
You will of course need to tweak this code a little but it’s absolutely possible to do what you are asking.
Can do with Gato GraphQL: [https://gatographql.com/highlights#bulk-post-creation-using-templates](https://gatographql.com/highlights#bulk-post-creation-using-templates)