This is my first day on wpquestions, I found it through Google and this is my first question. I'd like to thank you all in advance for answers and the owners of this site, fantastic community idea.
So, I am developing WP themes and I'm needing to setup themes with dummy data, categories and menu. I have seen in other themes when first going to a frameworks 'button' in WP admin, it gives option of "Would you like to install theme data?" or "Manual install".
I wonder the best method for this? Is it just a simple case of running a php script to insert data to the db or are these specific WP hooks and functions?
An example wins the loot. Thanks all. =)
If you want to create some dummy data, you can use some hooks when setup theme. I've made an example of this method that may help you understand the idea (put it in functions.php file of your theme):
You can repeat each step in the example to create more categories, posts, menu and sidebars.
Victor Teixeira answers:
I really don't know exactly but I think it just uses the import functions of wp to import the data from an xml file.
If you have seen themes with this option, you can just take a look at the php code and get some ideas or just build the same functions inside your theme.
Remember that there are lots of wp themes that are GPL licensed, even comercial themes.
Yes, I know I can look at their source, the biggest thing I lack right now though is time. Hence why I'm asking here. ;)
It was also a good excuse to test this site and the response time before I post some more 'meaty' questions.
Lucas Wynne answers:
First you're going to need to populate a WP site with data.
Then go to Tools > Export and save the file.
Now you can go to another WordPress install and go to Tools > Import > WordPress and import the file that you created and the new WP site will contain the data of the site you exported from.
Yes but I'm wanting an automated way to import this data when a customer that has purchased the theme clicks a 'install data' button.
I want to limit the amount the customer has to do and the knowledge they need to install a theme. Making it as simple as possible.
Lucas Wynne comments:
The only option in that case would be to have them upload it to their site through an FTP client like Filezilla and provide them the entire WordPress file, instead of just the theme.