title: How can I switch WordPress to mobile theme (with link to full site)
body: <p>I'm building a website in WordPress which has a separate mobile theme (this obviously uses the same database as the main site). The mobile theme is a child of the main theme, to maximize code reuse. </p>
  
  <p>I downloaded a mobile detection script that works pretty well, but I can't figure out how to switch to the mobile theme only for the current user, with an option to link to the full website.</p>
  
  <p>I don't want to create a multisite for this - it seems like an overkill (and there's the duplicate content issue). </p>
  
  <p>I tried two ways:</p>
  
  <ul>
  <li>themeswitch: Redirect to <code>http://example.com/?theme=mobile_theme</code> - not working</li>
  <li><p>a weird solution I found somewhere on the web:</p>
  
  <pre><code>add_filter( 'template', 'wpse_49223_change_theme' );   
  add_filter( 'option_template', 'wpse_49223_change_theme' );  
  add_filter( 'option_stylesheet', 'wpse_49223_change_theme' );
  
  function wpse_49223_change_theme($theme) 
  {
      include 'script/Mobile_Detect.php';
      $detect = new Mobile_Detect();
      if ( $detect-&gt;isMobile() )
          $theme = 'pinnacle_mobile';
      return $theme;
  }
  </code></pre></li>
  </ul>
  
  <p>This is not working either.</p>
  
  <p>Does anyone have a working solution to this?</p>