I'm working on something that requires a user to have a plugin. I only want them to have to install one thing. Can I have a plugin that has a theme with it?

  • 1
    Have you seen tgmpluginactivation.com? It might have to be packaged with your theme and on activation you could install your plugin along with any other supporting plugins.
    – jgraup
    Jan 16, 2016 at 6:06
  • 2
    I am almost double sure that if it is even possible it would require a huge amount of work. You can just simply ship your theme with mu plugins instead of trying to ship a theme inside a plugin Jan 16, 2016 at 6:38
  • Yep. Going to put this on hold for now. Jan 19, 2016 at 6:38

1 Answer 1


You could always set WP_USE_THEMES to false, and handle all the template/display logic on your own. (But, that requires access to the users wp-config or index to set the constant, which is out of scope for a plugin, though you could make it an installation requirement).

Taking a look at template-loader.php you could have an starting point to see the kind of logic you would need to reimplement.

Or otherwise you could let your users choose a theme as a fallback for all the situations not covered by your plugin, and make copious use of template_include to choose your plugin provieded templates on certain scenarios circumstances.

Directly from the codex:

add_filter( 'template_include', 'portfolio_page_template', 99 );

function portfolio_page_template( $template ) {

if ( is_page( 'portfolio' )  ) {
      $new_template = locate_template( array( 'portfolio-page-template.php' ) );
      if ( '' != $new_template ) {
        return $new_template ;

  return $template;

At first blush I'd say that the second approach it's a bit sounder, but even then I would put more work into decoupling theme from plugin to give yourself and your users more flexibility in the future.

  • It seems to be much more work than asking them to install two things rather than one Jan 19, 2016 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.