How to render a theme if we passed via URL in wordpress?

I have a wordpress site and I want to change every themes via query string URL.

So I have 5 different themes and want to switch over them via passing the name of theme in URL.

Read More

e.g.: I have themes named like (red,green,blue,etc).
and currently red theme is activated in wordpress admin and also I don’t want to change theme from admin panel.

I just like to change theme via URL:

  1. example.com?act_theme=red (Page should be display in blue theme)

  2. example.com?act_theme=green (Page should be display in green theme)

  3. example.com (Page should be display in red theme)

so here I am searching for is there any function or any plugin for it?

I googled this situation but doesn’t get exact need.

thanks

Related posts

1 comment

  1. You want to use the PHP GET method in order to get the variable `act_theme” and set the stylesheet accordingly, so your function would look something like this:

    <?php
        if(strcmp($_GET['act_theme'],'red') == 0) {
            echo <link type="text/css" rel="stylesheet" href="'.get_stylesheet_uri().'/red.css">
        }
        if(strcmp($_GET['act_theme'],'blue') == 0) {
            echo <link type="text/css" rel="stylesheet" href="'.get_stylesheet_uri().'/blue.css">
        }
        // etc... etc...
    ?>
    

Comments are closed.