Making a one click sample install or just use XML import/export?


#1

I am having a ton of issue with attachments, I am so sick with wp import/export plugin, I feel like doing phpmyadmin is the best way to do anything. I just moved a new version of one of my themes to the live demo server and the best way to do it was via SQL and went smooth.

Now exporting the sample_data.xml does export the XML file properly but fails to import Media on a different site.

Do you know any better way to go around this? Is there a tutorial or some wp trick to do I am not aware of?


How to make "import demo in one click" option ?
#2

We actually made a 1 click import for some features in our new theme. Problem is, by importing the database some stuff cannot be imported, like widgets, so we end up just importing elements that we couldn’t with the wp plugin. If you find something please let me know because we couldn’t :confused:


#3

This would make an awesome tutorial on the wptuts+ really!!


#4

I’m always curious how they make this “1 click demo install”. Hope someone would like to reveal the secret


#5


#6

^ it’s not only about clicking twice or more, but the simplicity of sample data installation. So the user can find out what they have to do


#7

I use a modified version of the importer plugin and changed the class name so it doesn’t conflict. You can also make it look almost exactly like the demo by using use add_option() in the importer to import data into your options panel such as social icons, fonts, colours, settings and other things that the importer wouldn’t usually do.

You can also use set_theme_mod() in the importer so it also sets the menu location, something the default importer doesn’t do.

I might post an example if you guys are interested.

EDIT: Also 1Click demo installers can drastically cut down your support tickets. It is definitely something to look into.


#8
Jaynesh said

I use a modified version of the importer plugin and changed the class name so it doesn’t conflict. You can also make it look almost exactly like the demo by using use add_option() in the importer to import data into your options panel such as social icons, fonts, colours, settings and other things that the importer wouldn’t usually do.

You can also use set_theme_mod() in the importer so it also sets the menu location, something the default importer doesn’t do.

I might post an example if you guys are interested.

EDIT: Also 1Click demo installers can drastically cut down your support tickets. It is definitely something to look into.

Yes please! An example would be epic


#9
DistinctiveThemes said
Jaynesh said

I use a modified version of the importer plugin and changed the class name so it doesn’t conflict. You can also make it look almost exactly like the demo by using use add_option() in the importer to import data into your options panel such as social icons, fonts, colours, settings and other things that the importer wouldn’t usually do.

You can also use set_theme_mod() in the importer so it also sets the menu location, something the default importer doesn’t do.

I might post an example if you guys are interested.

EDIT: Also 1Click demo installers can drastically cut down your support tickets. It is definitely something to look into.

Yes please! An example would be epic

+1


#10
Jaynesh said

EDIT: Also 1Click demo installers can drastically cut down your support tickets. It is definitely something to look into.

+1 I finally got around to doing this, and I’ve got admit, I wish I’d done this on every theme. The support ticket difference is unbelievable.


#11
Jaynesh said

I use a modified version of the importer plugin and changed the class name so it doesn’t conflict. You can also make it look almost exactly like the demo by using use add_option() in the importer to import data into your options panel such as social icons, fonts, colours, settings and other things that the importer wouldn’t usually do.

You can also use set_theme_mod() in the importer so it also sets the menu location, something the default importer doesn’t do.

I might post an example if you guys are interested.

EDIT: Also 1Click demo installers can drastically cut down your support tickets. It is definitely something to look into.

+1 too. Really interested. :slight_smile:


#12

Hey guys I am working on a new version of my 1 click installer … I will try to make it as a plugin and add on git for everyone :wink:


#13

I am in heaven :slight_smile:


#14

Wordpress allows us to enter posts, pages, custom post types and other into the database so that is basically what I do with some PHP instructions. We can even add images to the media library and connect them to posts using their ID.
As far as I know this is better than XML import, because it works everywhere.


#15
Pirenko said

Wordpress allows us to enter posts, pages, custom post types and other into the database so that is basically what I do with some PHP instructions. We can even add images to the media library and connect them to posts using their ID.
As far as I know this is better than XML import, because it works everywhere.

xml import is best for importing pages and posts, there are problems when you try to insert using database options, when you save sql dump in a file , if there are extra characters present it won't work and manipulating core tables is not recommended ;) . Best way is to export as encoded text even serialized string wont work if there is a new line.

#16

I am interested also in a tut or plugin for a one click install!


#17
Artillegence said

xml import is best for importing pages and posts, there are problems when you try to insert using database options, when you save sql dump in a file , if there are extra characters present it won’t work and manipulating core tables is not recommended :wink: . Best way is to export as encoded text even serialized string wont work if there is a new line.

Nobody spoke about using SQL dump or SQL instructions... I think that it is not even allowed as you can see here: http://support.envato.com/index.php?/Knowledgebase/Article/View/472/85/wordpress-theme-submission-requirements . At a certain point you have this rule: The database shouldn't be accessed or modified directly. If there is a defined function that can get the data you need, that must be used instead. Use $wpdb and its methods to interface with the database instead of rolling your own.

So, as an example, here's how I add a page:

$new_page_title = 'About Us';
$new_page_content = 'This is the page content';
$new_page = array(
'post_type' => 'page',
'post_title' => $new_page_title,
'post_content' => $new_page_content,
'post_status' => 'publish'
);
$new_page_id = wp_insert_post($new_page);

Pretty simple, huh?

#18
Pirenko said
Artillegence said

xml import is best for importing pages and posts, there are problems when you try to insert using database options, when you save sql dump in a file , if there are extra characters present it won’t work and manipulating core tables is not recommended :wink: . Best way is to export as encoded text even serialized string wont work if there is a new line.

Nobody spoke about using SQL dump or SQL instructions... I think that it is not even allowed as you can see here: http://support.envato.com/index.php?/Knowledgebase/Article/View/472/85/wordpress-theme-submission-requirements . At a certain point you have this rule: The database shouldn't be accessed or modified directly. If there is a defined function that can get the data you need, that must be used instead. Use $wpdb and its methods to interface with the database instead of rolling your own.

So, as an example, here's how I add a page:

$new_page_title = 'About Us';
$new_page_content = 'This is the page content';
$new_page = array(
'post_type' => 'page',
'post_title' => $new_page_title,
'post_content' => $new_page_content,
'post_status' => 'publish'
);
$new_page_id = wp_insert_post($new_page);

Pretty simple, huh?

yeah I use that too for my express installer … but its not usable for replicating demo as it … just my opinion :slight_smile:


#19
Artillegence said

yeah I use that too for my express installer … but its not usable for replicating demo as it … just my opinion :slight_smile:

Show us some code :slight_smile:


#20

I’ll write an article.

I was able to create in a new version of our framework (to be released yet) a installer that works with AJAX and is able to:

  • Import posts/pages/custom posts (with the default XML Import class from WP, so no news here)
  • Define the menus locations automatically
  • Import all widgets to the correct sidebars
  • Define the demo’s options in theme options panel

I don’t know if is what you guys are looking for, so let me know and I can try help :slight_smile:

Matthew Schultz - Dev