Support » Plugin: JP Theme Switcher Bar » stay on same page when switch?

Viewing 1 replies (of 1 total)
  • Plugin Author Josh Pollock


    Right now the link is constructed using site_url() plus the theme query var. See:


    You could add a method to get the current url instead of site_url(), something like this:

    function current_page_url() {
    		$pageURL = 'http';
    		if( isset($_SERVER["HTTPS"]) ) {
    			if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
    		$pageURL .= "://";
    		if ($_SERVER["SERVER_PORT"] != "80") {
    		} else {
    		return $pageURL;

    Here’s the catch, if current URL already has a variable attached, then you need to append &theme= instead of ?theme= for obvious reasons. Not sure if that should be handled with conditionals or str_replace().

    If you get this working and submit a pull request ( I’d be grateful.

    Take care,

Viewing 1 replies (of 1 total)
  • The topic ‘stay on same page when switch?’ is closed to new replies.