Hi, the code below was added by my colleage to redirect page mobile pages as some of the designs such us Montoya moving grid are not responsive and do not display in the same manner as in desktop. However the redirection only works in the beggining and after few hours, not at all. Here is the code added in php.functions:
// FOR MOBILE REDIRECT add_action( 'template_redirect', 'redirect_on_mobile_page' ); function redirect_on_mobile_page(){ if ( wp_is_mobile() && is_front_page() ) { wp_redirect(home_url('/hpmobile')); exit; } } function redirect_about_to_mobileabout() { // Check if the user is on the "About" page if (is_page('about')) { // Detect if the user is on a mobile device if (wp_is_mobile()) { // Redirect to the "MobileAbout" page wp_redirect(home_url('/aboutm')); exit; } } } add_action('template_redirect', 'redirect_about_to_mobileabout');
Hi, the code below was added by my colleage to redirect page mobile pages as some of the designs such us Montoya moving grid are not responsive and do not display in the same manner as in desktop. However the redirection only works in the beggining and after few hours, not at all. Here is the code added in php.functions:
// FOR MOBILE REDIRECT
add_action( 'template_redirect', 'redirect_on_mobile_page' );
function redirect_on_mobile_page(){
if ( wp_is_mobile() && is_front_page() ) {
wp_redirect(home_url('/hpmobile'));
exit;
}
}
function redirect_about_to_mobileabout() {
// Check if the user is on the "About" page
if (is_page('about')) {
// Detect if the user is on a mobile device
if (wp_is_mobile()) {
// Redirect to the "MobileAbout" page
wp_redirect(home_url('/aboutm'));
exit;
}
}
}
add_action('template_redirect', 'redirect_about_to_mobileabout');
?>
Try the following:
Thank you.
Clapat Support
Review Envato Item Support Policy
Follow us!
https://www.clapat.com/
https://www.facebook.com/clapat.ro
https://www.instagram.com/clapat.themes/
https://x.com/clapatdesign
https://www.linkedin.com/company/clapatstudio
https://www.tiktok.com/@clapatstudio