Support » Plugins » Hacks » possible to activate a theme through a plugin ?

  • Resolved wpprogrammeurs.nl

    (@wordpressprogrammeursnl)


    Is it possible to activate a theme through PHP / API ?

    Would like my plugin to perform one of the following in order of preference:

    – upon plugin activation, check for theme presence, if not present, upload and activate it (from wordpress.org repository)

    OR IF NEEDED

    – upon plugin activation, copy A piggybacked theme folder from my plugin folder to themes folder, then activate theme.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Though i haven’t tried something like that myself, there is a function called switch_theme().

    When you hover your mouse in the Design/Themes menu on a activation link, you can see the two parameters passed to this function, namely ‘template’ and ‘stylesheet’.

    You can have a look at the file wp-admin/themes.php where this function is being used.

    Thread Starter wpprogrammeurs.nl

    (@wordpressprogrammeursnl)

    In the meantime I have tried it and converted it into a working plugin.

    Works great ! Thank you much …

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘possible to activate a theme through a plugin ?’ is closed to new replies.