Jump to content

Recommended Posts

Hi, I have been working on coding multiple mobile redirects that can be entered via a form... I can get it to work fine without the form but once I introduce the form I can only get the first redirection to work and if I try to add additional ones like 'pagetitle_url22' they don't work... I can confirm that the values are getting saved in the db... here's an example of my code-

function emr_single_page_only(){
		global $emr_options;
		if (is_page(get_option('page_number11'))) {
			emr_mobile_redirect();
		}
		elseif (is_page(get_option('page_number22'))) {
			emr_mobile_redirect2();
		}
	}
	add_action('get_header','emr_single_page_only');

function emr_mobile_redirect(){
		global $emr_options;
		if ($emr_options['enabled'] == true)
		{
			$detect = new Mobile_Detect();
			if ($detect->isTablet() && $emr_options['tablet'] == true)
			{
				$detect = "false";
			}
			elseif ($detect->isMobile())
			{
				header('Location: ' . $emr_options['mobile_url']);
				exit;
			}
		}
	}
function emr_mobile_redirect2(){
		global $emr_options;
		if ($emr_options['enabled'] == true)
		{
			$detect = new Mobile_Detect();
			if ($detect->isTablet() && $emr_options['tablet'] == true)
			{
				$detect = "false";
			}
			elseif ($detect->isMobile())
			{
				header('Location: ' . $emr_options['mobile_url22']);
				exit;
			}
		}
	}

Any suggestion are appreciated!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.