20 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Located in Canada
+2 more
gnrocks says

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 !

63 posts
  • Has collected 1+ items on Envato Market
  • Located in Italy
  • Has been part of the Envato Community for over 1 year
Kronris says

+1
I’m also interested in this.

495 posts
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
wopethemes says
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_id
Insert custom data suck as portfolios,slider contents. You’re creator of them so you will know how to insert them
Anything else?
20 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Located in Canada
+2 more
gnrocks says

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_id
Insert 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 ?

499 posts
  • Has referred 1000+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+8 more
pixelentity says

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.

495 posts
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
wopethemes says


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_id
Insert 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 ?
We can’t use sql file because the data need some relative data like author id . Post id maybe duplicate…ect

Inserting data is easier way to prevent any bugs.


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!

499 posts
  • Has referred 1000+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+8 more
pixelentity says

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!
Just 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.
495 posts
  • Has referred 10+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
wopethemes says


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!
Just 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.
Oh. Maybe yes. Agree with your point.
by
by
by
by
by
by