- This topic has 10 replies, 3 voices, and was last updated 2 years, 12 months ago by
Leo.
-
AuthorPosts
-
February 2, 2020 at 8:24 am #1152175
manaadiar
Hi Tom, sorry the below code that you suggested (and worked) for other site is not working for me..I am using GP Premium with a child theme..
Can you pls advise..??
add_action( ‘wp’, ‘tu_redirect_mobile’ );
function tu_redirect_mobile() {
if ( wp_is_mobile() AND is_front_page() ) {
wp_redirect( ‘https://beta.zeine.es/contacto-movil’, 301 );
exit;
}
}February 2, 2020 at 9:55 am #1152241Leo
StaffCustomer SupportI’m marking this resolved as per this:
https://generatepress.com/forums/topic/different-homepage-for-mobile/#post-1152173Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/February 2, 2020 at 10:24 am #1152260manaadiar
Hi Leo, no, it didn’t work.. I thought if I use the mobile option in the customize screen and change there, it will work.. But I see it changed the whole home page and i realised that the mobile sign there only “shows” how it will look..
What i want is, currently my home page is https://shippingandfreightresource.com.. I want the home page to show https://shippingandfreightresource.com/mob-home when users are viewing on mobile device..
February 3, 2020 at 6:59 am #1153005manaadiar
Hi Leo, no, it didn’t work.. I thought if I use the mobile option in the customize screen and change there, it will work.. But I see it changed the whole home page and i realised that the mobile sign there only “shows” how it will look..
What i want is, currently my home page is https://shippingandfreightresource.com.. I want the home page to show https://shippingandfreightresource.com/mob-home when users are viewing on mobile device..
February 3, 2020 at 7:12 am #1153018David
StaffCustomer SupportHi there,
you will need to use the PHP snippet that Tom provides here to create a redirect for mobiles:
https://generatepress.com/forums/topic/different-homepage-for-mobile/#post-554306
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/February 3, 2020 at 7:14 am #1153024manaadiar
Hi David, i did use it but doesn’t seem to work on my site..
February 3, 2020 at 7:22 am #1153032David
StaffCustomer SupportHow are you adding the code ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/February 3, 2020 at 7:24 am #1153034manaadiar
its there in functions.php file
February 3, 2020 at 7:44 am #1153069David
StaffCustomer SupportTry adding it using the Code Snippets plugin – if it still doesn’t work then some other function must be conflicting with it.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/February 3, 2020 at 12:06 pm #1153303manaadiar
I dont have the code snippets plugin.. Can you suggest any other code..??
February 3, 2020 at 12:11 pm #1153307Leo
StaffCustomer SupportCan you disable all other custom functions to test for now?
And make sure to clear and disable the caching plugin during testing.
That code should be correct. It’s a WordPress function and not controlled by the theme:
https://developer.wordpress.org/reference/functions/wp_redirect/Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.