Viewing 15 replies - 16 through 30 (of 30 total)
  • Thread Starter FaithJava

    (@faithjava)

    I just did now and here is the error message I have:
    Parse error: syntax error, unexpected T_STRING, expecting ‘(‘ in /hermes/bosoraweb116/b1268/ipg.mywebsite/movies/wp-content/plugins/php-mobile-redirect/includes/functions.php on line 8

    Plugin Author Code96

    (@code96)

    Please post the plugin functions.php code again. Thanks

    Thread Starter FaithJava

    (@faithjava)

    Okay here it is:

    <?php
    
    	// Replace----
    	/*add_action('init', 'pmr_mobile_redirect');*/
    
    	// with-----
    	function pmr_single_page_only(){
    		if (is_page(591)){
    			pmr_mobile_redirect();
    		}
    	}
    	add_action('get_header','pmr_single_page_only');
    
    	function pmr_mobile_redirect(){
    
    		global $pmr_options;
    
    		if ($pmr_options['enabled'] == true)
    		{
    			$detect = new Mobile_Detect();
    
    			if ($detect->isMobile() && isset($_COOKIE[$pmr_options['mobile_cookie']]))
    			{
    				$detect = "false";
    			}
    			elseif ($detect->isMobile())
    			{
    				header('Location: https://' . $pmr_options['mobile_url']);
    				exit;
    			}
    		}
    	}

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    Plugin Author Code96

    (@code96)

    Have you tried the is_single(591) yet?

    Plugin Author Code96

    (@code96)

    Also, once you paste your code, highlight it and select the “code” button in this editor. It will display as intended.

    Thread Starter FaithJava

    (@faithjava)

    Yes, what I did was to change:
    is_page(591)

    with

    is_single(‘591’)

    and it shows error message:
    Parse error: syntax error, unexpected T_STRING, expecting ‘(‘ in /hermes/bosoraweb116/b1268/ipg.mywebsite/movies/wp-content/plugins/php-mobile-redirect/includes/functions.php on line 8

    Plugin Author Code96

    (@code96)

    is_single(591) – try that

    Thread Starter FaithJava

    (@faithjava)

    okay, I will right away

    Thread Starter FaithJava

    (@faithjava)

    When I click on the link I wanted to access that will activate the redirect on mobile, it popup
    HTTP Error 0: An error occurred while communicating with the origin server. Please try again.
    With 2 Button “OK” and “Details”
    If I click on “OK” button, the message will disappear, if I click on “Details” button, then it will now redirect me to the page have set for redirect.

    Plugin Author Code96

    (@code96)

    What are you using to access this. There is no way I can help you without knowing the URL. Do you have an email that I can contact you at, to pass the URL privately?

    Plugin Author Code96

    (@code96)

    Or you can contact me through my site: Code 96 WordPress Design

    Thread Starter FaithJava

    (@faithjava)

    Thank you my friend, have check it out on other mobile devices, it works perfectly.
    Thank you so much, have rated your plugin 5 stars and recommend it for others.

    Good Luck

    Plugin Author Code96

    (@code96)

    Thanks, glad we got it working.

    Take care..

    Thanks for the solution here, been looking for a while for a way to redirect my front page to a different page on mobile. Thank you for that. I just want to add a note for anyone reading this solution – if you’re using a cache plugin, you would either need to disable it on the page that’s being redirected, or disable the cache on mobile devices.

    Hi, I’m trying to actually use redirect on all pages except one.
    So, if user comes to my https://www.mysite.com/no-mobile-redirect from a mobile device, there is no redirect. On all other cases there is redirect to https://www.m.mysite.com&#8230;

    I tryed to use the following code, but for some reason it doesn’t work…

    function pmr_single_page_only(){
    if (!is_page( '498' ) || !is_post( '498' ) {
       pmr_mobile_redirect();
    }
    add_action('init', 'pmr_single_page_only');

    Any suggestions?

Viewing 15 replies - 16 through 30 (of 30 total)
  • The topic ‘Apply Redirect to a particular page only’ is closed to new replies.