I am wondering if anybody has an idea about how to make this possible.
1: User chose a website design from a gallery in my website. 2: Then, I create a hosting for my user and Install wordpress, but with the chosen theme.
I already have a module to autoinstall wordpress after provisioning the hosting. but this comes with the default theme.
I do not want to do this manually, the only idea I have is to create copies of Wordpress installations with the selected theme, and then upload them via ftp to each user, but I would like to know if anybody has a better idea, I would really appreciate your comments.
I use WHMCS to activate the hosting in Cpanel, and I have a module to autoinstall wordpress.
Best regards
There are several ways to achieve this. It really depends on your automation/workflow.
You could invoke a small bash script that interacts with WP CLI. For example:
wp theme activate mytheme
Or you could update the database manually with:
update_option('current_theme', 'my_theme');
update_option('template', 'my_theme');
update_option('stylesheet', 'my_theme');
update_option('my_theme_options', $theme_options );
Or via PHP:
switch_theme( 'my_theme' );