If you want to set a different static homepage for mobile version in WordPress? Use following code in your theme’s functions.php file OR in site specific plugin.
1 2 3 4 5 6 7 8 9 10 11 | /** * Set a different static homepage for mobile version in WordPress. */ function so16165211_mobile_home_redirect(){ if( wp_is_mobile() && is_front_page() ){ include( get_template_directory() . '/home-mobile.php' ); exit; } } add_action( 'template_redirect', 'so16165211_mobile_home_redirect' ); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.