WordPress.org

Ready to get started?Download WordPress

Forums

Change Theme Based On Domain Accessed, not working (1 post)

  1. Randuin
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.