• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

mobile detect redirect

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › mobile detect redirect

This topic is: not resolved

Tagged: detect mobile, detect mobile redirect, mobile detect redirect, redirect mobile

  • This topic has 6 replies, 3 voices, and was last updated 9 years, 10 months ago by CynthiaC.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • May 19, 2013 at 11:26 am #41623
    CynthiaC
    Participant

    I am using the "News" responsive theme and would like to develop a simple 'home page' using the Landing Page feature that will ONLY be the home page when it detects a mobile browser.

    Eg:

    laptop will go to http://www.mywebsite.com

    mobile device is automatically redirected to http://www.mywebsite.com/mobilehome/

    I have found different suggestions on the interweb but rather than muck up some perfectly good code I thought there might be a tried and tested Genesis Fix.

    Thank you

    May 19, 2013 at 1:14 pm #41643
    Anita
    Keymaster

    The problem you may have is that you can define a screen size for the laptop in the media queries, however if other mobile devices are the same size - they too will be taken to that page. Do you want a particular sized device to show that new page?


    Love coffee, chocolate and my Bella!

    May 19, 2013 at 1:25 pm #41648
    CynthiaC
    Participant

    I would say it would  be most useful/practicable for the iphone/android or mini ipad.  Everything else would be just fine using the regular home page.

     

    May 19, 2013 at 6:27 pm #41721
    Anita
    Keymaster

    Okay. Each theme developer codes media queries differently and some add all of them, while some only add a few. It is impossible to really anticipate all mobile devices but they do their best to code for the common ones. For example, some themes have issues with different browser version. The same with mobile devices - they come out with so many so quickly that there's no way to keep up. So... the best thing to do is just try to come as close as reasonably possible.

    Brian Gardner wrote this Introduction to Media Queries. Read this and maybe you might see some type of mobile query that fits what you are looking for. Then copy paste it under your media queries and then add the styles in there.

    http://www.briangardner.com/media-queries/


    Love coffee, chocolate and my Bella!

    May 19, 2013 at 7:26 pm #41733
    CynthiaC
    Participant

    That doesn't quite address the redirect issue.

    I would like the website to automatically redirect to a different home page when it detects a mobile device.

    Script would be something like this - but hoped for something to put in the function.php file instead?

    <script type="text/javascript">
    $(document).ready(function(){
    if($(window).width() < 600){
    window.location.href = "http://mywebsite.com/mobilehome/"
    }
    });
    </script>

    May 19, 2013 at 8:54 pm #41747
    Bill Murray
    Member

    @CynthiaC - I think you understand you can't do this with media queries/responsive design.

    If you want to redirect mobile users to 1 page, the fastest way to do it would be via UA detection or MIME-type support (such as a check for WML) followed by redirection in your htaccess file (assuming your site is on an Apache server). These methods aren't 100% foolproof, but they are pretty reliable. Your script solution would be another route (you could use Genesis settings to get that into the head of your document). There are also open source PHP libraries, like php-mobile-detect. I think the htaccess route would be the fastest.

    While you can do what you want, you might want to pause and ask yourself whether you should do what you want. From an SEO perspective, what you want to do isn't a great SEO strategy. More info here.

    Hope that helps.


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    May 20, 2013 at 11:54 am #41857
    CynthiaC
    Participant

    Thanks to both of you,

    Lots of food for thought.

    I guess I will set up an 'experimental' site and see what I can come up with.

     

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble