• Hi, I’m setting up a site where the theme must be tied to the entrance URL. I’ve got that figured out. My problem is how to have the php run before the template loads. The way it works now, I have to load the default template first and then on the refresh it will display the newly configured one. How can I choose the template before loading?

    Here is the code I’m working with, which I placed in the header of my default template:

    <?php
    
    if (isset($_GET['site'])) {
    
    $theme=$_GET['site'];
    update_option( 'template', theme2);
    update_option( 'stylesheet', theme2 );
    update_option( 'current_theme', theme2 );
    
    } else {
    
    update_option( 'template', default );
    update_option( 'stylesheet', default );
    update_option( 'current_theme', default );
    
    }
    
    ?>
Viewing 1 replies (of 1 total)
  • Thread Starter robahas

    (@robahas)

    I realized after posting that this is all wrong-headed. I need something that applies to each user. This code changes the theme for all users! Apologies….

Viewing 1 replies (of 1 total)
  • The topic ‘Theme Switching via GET’ is closed to new replies.