Programmatically install and activate child-theme


Is there a way to install and activate a child-theme from zip file like we do with TGM-Plugin-Activation which helping us to suggest or force user to install and activate a plugin.

So my idea is that i want to create a plugin with a form to choose child themes and then when the user choose one it will install and activate it.

Thank you.


I have a plugin who create an option page with this kind of forms.
enter image description here

Then I retrieve variables like this:

function getHeader($theme)
global $Header;
global $biblio_options;
$biblio_settings = get_option('biblio_options', $biblio_options);
$theme = $biblio_settings['themechoice'];
if ($theme == 'thmone' || $theme == null)
    $Header = get_header();


when client choose for exemple theme 1 then i changed the header and it’s style and everything works fine.

But now I like to have the same with child theme so when user choose theme 1 on the plugin it will install a child-theme1 from a zip file who will be on the plugin folder then activate it.

Thank you for your help.

, , Carl Willis 8 months 0 Answers 66 views 0

Leave an answer