WordPress.org

Support

Support » Plugins and Hacks » Change Theme Based On Domain Accessed, not working

Change Theme Based On Domain Accessed, not working

  • Randuin

    @randuin

    I have multiple domains pointed to the same WordPress install and I’m trying to make it so that the theme would change based on the domain you access it with.

    function theme_based_on_domain( $template = '' ) {
       if ( preg_match( '/\S*\.?mydomain\.com/', $_SERVER['HTTP_HOST'] )) {
         $template = 'ImpreZZ';
       }
       return $template;
     } 
    
     add_filter('stylesheet', 'theme_based_on_domain');
     add_filter('template', 'theme_based_on_domain');

    This is the piece of code I’m using. The Stylesheet applies perfectly fine but the template refuses to work.

  • The topic ‘Change Theme Based On Domain Accessed, not working’ is closed to new replies.