Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a homesite and a second site. They are displayed to normal browsers.

But I would like to show IOS and mobile devices the second site as homesite and hide the normal homesite.

How can I do this?

Joerg

share|improve this question
add comment

2 Answers

If the url's for both site is different, You can simply check if site is being viewed from mobile or not and than you can redirect to your second site if it is mobile...

Here is one of code who detects whether it is mobile or not...

http://detectmobilebrowsers.mobi/

You can use such code detect mobile browser agent and put it on first site and if mobile is detected redirect them to second site..

share|improve this answer
add comment

You can use a plugin like W3 Total Cache which has User Agent detection and can serve a different theme or redirect to a mobile site based on what browser a visitor is using.

WordPress has some more basic User Agent detection built in. You can target the iPhone with the is_iphone function. So for example you could add something like this to your themes header.php:

<?php global $is_iphone; if($is_iphone) { ?>
     <meta http-equiv="refresh" content="0; url=http://MobileSite.com/">
<?php } ?>

Here's a list of all the browser detection functions from the WordPress Codex.

share|improve this answer
1  
There aren't conditional functions for this. These are global variables. Instead of is_iphone() you have to use global $is_iphone; if($is_iphone) –  rofflox Sep 25 '11 at 17:03
    
Ahh,thanks. I hadn't tested it, I've updated my answer. –  Jono Warren Sep 25 '11 at 20:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.