Hello!
I am using the Pro theme, and we have developed special web pages within our Wordpress environment for use in our Mobile App, some of which duplicate the content of the main pages, but with a no header/footer template. When these pages are updated, both the main page and the app page.
We have been trying to find a solution to make it so that we can pull the main page, but add a query to the end of the URL to get it to change the template. I have found some code that works, but unfortunately it doesn’t work on the Pro theme. It firstly displays the page with the correct theme, but then under it, it’s basically repeating the content but with the main template.
Please see here: https://www.gateway978.com/coronavirus?template=page_noheaderfooter
This is the code I am using in the Child theme’s functions.php:
add_filter( 'template_include', 'change_page_template_call' ); function change_page_template_call( $template ) { // Check if our GET parameter exists and holds a specific value if( isset( $_GET['template'] ) && 'page_noheaderfooter' == $_GET['template'] ) { // Attempt to locate our template $new_template = locate_template( array( 'template-blank-3.php' ), true ); return $new_template; }else{ return $template; } }
Can anyone help with this please? Thank you!!