A few weeks ago a client asked me whether it is possible to show a different homepage on mobile devices than on the desktop version (a redirect). I’ve written the following function and added this to the client’s themes functions.php.
This function adds a small script to the head section of the theme. The script checks if you’re on the homepage and if the width of your browser is 480px or smaller. In case both are true the web shop page is loaded, instead of the default homepage (see the code example above).
A great and simple function. But, what happens when the permalink or slug changes or the client wants to set another page as mobile homepage? Wouldn’t it be great if he is able to set the redirect in his WordPress backend? I figured this would be a great idea, so I developed the Genesis Mobile Redirect Plugin.
Genesis Mobile Redirect Plugin
The Genesis Mobile Redirect plugin allows you to select a page or a custom URL, which you can set as homepage for mobile devices. You set the redirect either for smartphone or for smartphone and tablet. You can also set your custom max width if you want to show the mobile homepage for example on smartphones in combination with iPad mini.