Go Back   CodingForums.com > :: Client side development > General web building > Building for mobile devices

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-04-2012, 11:44 AM   PM User | #1
Goudwaag
New to the CF scene

 
Join Date: Apr 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Goudwaag is an unknown quantity at this point
Hot to recognize that your site is viewed on mobile device.

I have a site for mij store www.degoudwaag.nl. I am using WordPress and I now want to go mobile with my site. My first question is (and sorry if it has been asked before, haven't found it): how can you get Wordpress to recognize that my site is viewed on a mobile device and how to redirect to i.e. an "m.address.com" address in that case?

Many thanks!

Last edited by WA; 07-16-2012 at 11:20 PM..
Goudwaag is offline   Reply With Quote
Old 07-16-2012, 10:00 PM   PM User | #2
kallejillheden
New to the CF scene

 
Join Date: Jul 2012
Location: Sweden / Sverige
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
kallejillheden is an unknown quantity at this point
If you download this file and put it into your site and then put this into your index.php file:

It needs to end with .php or else the script won't work
PHP Code:
require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect();
if(
$detect->isMobile() or $detect->isTablet()){
header("Location: http://m.yoursite.com/");

The script is not hard or complicated, if you reed it you would probably understand it clearly.

This will redirect any mobiles or tablets to your mobile version of your site.

More info on how you can use the Mobile_Detect.php file can be found here.

Important notes:
The file needs to be unzipped, and the content is going into your server.
The demo.php file is not necessary, only the Mobile_Detect.php file.
The Mobile_Detect.php file needs to be in the same directory as the file you put the script into.
kallejillheden is offline   Reply With Quote
Old 12-12-2012, 11:09 PM   PM User | #3
StevenHu
Regular Coder

 
Join Date: Jun 2011
Location: CA
Posts: 105
Thanks: 0
Thanked 10 Times in 10 Posts
StevenHu is an unknown quantity at this point
Wordpress has several plugins that provide this functionality. Here is one of them:
http://wordpress.org/extend/plugins/wptouch/
__________________
Steve Husting
http://iphonedevlog.wordpress.com
StevenHu is offline   Reply With Quote
Old 03-13-2013, 11:56 AM   PM User | #4
Goudwaag
New to the CF scene

 
Join Date: Apr 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Goudwaag is an unknown quantity at this point
Thanks for your replies guys! Eventually I decided to go with dudamobile.com. It costs a few bucks a year but is easy to implement and yield beautiful results. I am now considering doing that for my other website as well.

Last edited by VIPStephan; 03-13-2013 at 03:12 PM.. Reason: removed links
Goudwaag is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:57 AM.


Advertisement
Log in to turn off these ads.