Hi, CAMEO172, it sounds like you’re trying to do the same thing: figure out how to separate regular theme functions from functions used on AMP pages.
It sounds like you figured out how to remove unwanted functions with remove_all_filters( ‘the_content’ ); or remove_filter( ‘the_content’, ‘FUNCTION_NAME’ ); but then how do we unhook functions ONLY for AMP pages, yeah? I have the same question.
I’d prefer to check if the page being viewed is AMP, then remove (unhook) or add (hook) the functions as needed. However is_amp_endpoint is not working for me.
For example, in my ../amp/single.php it seems no matter how I use it with conditional logic, I get the result ‘undefined variable’ . is_amp_endpoint is not set…
if (isset($is_amp_endpoint )) {echo "is AMP";} else {echo 'isnt AMP';}
I get ‘isnt amp’… though the plugin is indeed installed and even serving up the ../url/amp version of the page in question
What is the proper way to check if a page is AMP or not? Seems like I’m missing something…
Alternative solution–
Though it would be best to check if a page is AMP or not, I suppose we could use something like https://github.com/scottsweb/mobble/blob/master/mobble.php to check if a mobile device is being used, and hook or unhook functions for AMP pages based on the plugin’s is_mobile function.
such as
if(function_exists('is_mobile')){ if(is_mobile){ //do AMP functions }}
Obviously this is not optimal, as many sites already have mobile-specific themes/pages separate from AMP…