Hi !
I have been struggling to find a tutorial to help me achieve this idea :
The WordPress default importer is not quite efficient for themes sold here as they contain, in addition to posts, custom options, sliders, widgets configuration, etc.
I’d like to be able to offer a one-click demo data installation to my customers. Does anybody know about a tutorial on how to achieve that ? I have seen some themes that offer this One-click demo data install, so i suppose it is possible 
Thanks in advance !
+1
I’m also interested in this.
In this script, it will auto insert posts (wp_insert_post) , portfolio,comments. resource of the content will be link to a exists folder (example : images).
There are some data will be relative to other , when you insert , you can get their’ID so we can make relative between data.
$wpdb->insert_idInsert custom data suck as portfolios,slider contents. You’re creator of them so you will know how to insert them
Anything else?
rongcon said
it maybe a demo_content.php script that will run when you click the install demo button.
In this script, it will auto insert posts (wp_insert_post) , portfolio,comments. resource of the content will be link to a exists folder (example : images).
There are some data will be relative to other , when you insert , you can get their’ID so we can make relative between data.
$wpdb->insert_idInsert custom data suck as portfolios,slider contents. You’re creator of them so you will know how to insert them
Anything else?
Thank you for the reply !
That’s a good idea !
But if the data file was to be integrated directly in the customer’s package/installation, would it not be better to directly do the upload with an .sql file instead of an xml file that will be hooked with wp_insert_posts ?
- Sold between 100 000 and 250 000 dollars
- Won a Competition
- Author was Featured
- Item was Featured
- Referred between 500 and 999 users
- Author had a Free File of the Month
- Author had a File in an Envato Bundle
- Bought between 10 and 49 items
Almost all authors offering “one click demo install” feature (including us) use the wordpress importer plugin. You cannot do this by sql, it would be too low level to be reliable.
Basically you include the export.xml file from your preview in the theme, then use the importer plugin to load the data. However, some stuff will not be imported (for instance widgets configuration) and requires custom code is if you want the buyer to get an exact copy of the preview site.
gnrocks saidWe can’t use sql file because the data need some relative data like author id . Post id maybe duplicate…ect
rongcon said
it maybe a demo_content.php script that will run when you click the install demo button.
In this script, it will auto insert posts (wp_insert_post) , portfolio,comments. resource of the content will be link to a exists folder (example : images).
There are some data will be relative to other , when you insert , you can get their’ID so we can make relative between data.
$wpdb->insert_idInsert custom data suck as portfolios,slider contents. You’re creator of them so you will know how to insert them
Anything else?Thank you for the reply !
That’s a good idea !
But if the data file was to be integrated directly in the customer’s package/installation, would it not be better to directly do the upload with an .sql file instead of an xml file that will be hooked with wp_insert_posts ?
Inserting data is easier way to prevent any bugs.
pixelentity said
Almost all authors offering “one click demo install” feature (including us) use the wordpress importer plugin. You cannot do this by sql, it would be too low level to be reliable. Basically you include the export.xml file from your preview in the theme, then use the importer plugin to load the data. However, some stuff will not be imported (for instance widgets configuration) and requires custom code is if you want the buyer to get an exact copy of the preview site.
I’m not sure the plugin can work. it maybe good to import some basic data like post,menu, categories,page and it can’t import custom data base on site features. I use wordpress import to import sample data xml from wordpress site and a large bugs happens
I also hate xml file also. I strongly recommend use php file to install data. for example use php array. Easy to use and update later also!
- Sold between 100 000 and 250 000 dollars
- Won a Competition
- Author was Featured
- Item was Featured
- Referred between 500 and 999 users
- Author had a Free File of the Month
- Author had a File in an Envato Bundle
- Bought between 10 and 49 items
rongcon saidJust take a look at wordpress importer plugin code because, If you choose to do the same thing by yourself, there are high chances you’ll end rewriting most of that stuff. You can’t just add post, there are a lot of other things you need to take into account (like url rewriting in content, for instance). It’s far easier to just use/extend what’s already done and works quite well than reinventing the wheel.
I’m not sure the plugin can work. it maybe good to import some basic data like post,menu, categories,page and it can’t import custom data base on site features. I use wordpress import to import sample data xml from wordpress site and a large bugs happens
I also hate xml file also. I strongly recommend use php file to install data. for example use php array. Easy to use and update later also!
pixelentity saidOh. Maybe yes. Agree with your point.
rongcon saidJust take a look at wordpress importer plugin code because, If you choose to do the same thing by yourself, there are high chances you’ll end rewriting most of that stuff. You can’t just add post, there are a lot of other things you need to take into account (like url rewriting in content, for instance). It’s far easier to just use/extend what’s already done and works quite well than reinventing the wheel.
I’m not sure the plugin can work. it maybe good to import some basic data like post,menu, categories,page and it can’t import custom data base on site features. I use wordpress import to import sample data xml from wordpress site and a large bugs happens
I also hate xml file also. I strongly recommend use php file to install data. for example use php array. Easy to use and update later also!
