WordPress

How to show a different homepage on mobile devices?

If you want to show different homepage for mobile device instead of desktop version then follow below steps.

First you need to create a separate page for mobile device then you need to add below code to your child theme’s function.php file and then simply replace the text “mypage” with your page url.

Note: do not remove “/” symbols, you need to add your page link like

If example my page url is “https://bombaytees.com/sell-your-artwork/” then you have to only add this much of text “sell-your-artwork” in between slash symbols

Click to download below code file from here & add to your function.php file

//* Redirect homepage on mobile

add_action( ‘wp_head’, ‘wps_params’, 10 );
function wps_params() {
?>

<script>
if (window.location.pathname == ‘/’ && jQuery(window).width() <= 567) {
window.location = “/mypage/”;
}
</script>

<?php
}