WordPress.org

Ready to get started?Download WordPress

Forums

WPtouch Mobile Plugin
[resolved] A way to force mobile mode (2 posts)

  1. Josh Levinson
    Member
    Posted 1 year ago #

    The only way thus far I have been able to force WPTouch into mobile mode dependant upon a url is with the following code I whipped up:

    add_filter('wptouch_supported_device_classes','empty_wp_touch_agents',10,1);
    function empty_wp_touch_agents($device_list){
    	return array();
    }
    add_action('setup_theme','url_wp_touch');
    function url_wp_touch(){
    	$url = $_SERVER['REQUEST_URI'];
    	$url = parse_url($url,PHP_URL_PATH);
    	$url = explode('/',$url);
    	if(array_search('mhome',$url)){
    		$touch = new WPtouchProThree();
    		$touch->WPtouchPro();
    		$touch->active_device = 'default';
    		$touch->active_device_class = 'default';
    		$touch->setup_mobile_theme_for_viewing();
    	}
    }

    Yes, I have the pro version. Not sure if this would work for the free version. My goal in posting here is to raise awareness and prove that it is definitely possible to do this, and there IS a need for it. Obviously what sucks is that this code is subject to the whims of WPTouch changing their class and/or function names.

    BraveNewCode - please make this a filter or something so that developers can force mobile mode if they want to, bypassing all requirements of user agents, etc.

    Again, there IS a good scenario for this, like when a portion of a site is going to be only accessed through a mobile app's built-in browser (pass-through). I have seen multiple requests for this and I kindly ask that you add some solution better than mine into your plugin.

    See: http://wordpress.org/support/topic/plugin-wptouch-call-mobile-version-with-direct-url

    http://wordpress.org/extend/plugins/wptouch/

  2. BraveNewCode Inc.
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    We'll continue this conversation in the ticket(s) you have opened in our WPtouch Pro support center.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic