show different template on mobile
-
Please I have this custom template called “content-single-mobile.php” and I want to use it to show single content for mobile visitors only. Please is there a way to hook this template with something like
add_filter( 'template_include', 'mobile_single_page_template', 99 ); function mobile_single_page_template( $template ) { if ( wp_is_mobile() && single_page() ) { $new_template = locate_template( array( 'content-single-mobile.php' ) ); if ( '' != $new_template ) { return $new_template ; } } return $template; }
I am thinking that this should work but I dont know where its not working rather it gives error. Thanks in advance
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘show different template on mobile’ is closed to new replies.