Title: Template tweaks
Last modified: August 31, 2016

---

# Template tweaks

 *  [CAMEO172](https://wordpress.org/support/users/cameo172/)
 * (@cameo172)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/template-tweaks/)
 * Hi,
 * Just a tiny question. I have read a lot of time the read me text and I have understand
   how to tweak the template.
    But just on question : where to add the functions?
   is it in a function.php in a amp folder ? In the function.php of my main theme?
   please tell me 🙂
 * [https://wordpress.org/plugins/amp/](https://wordpress.org/plugins/amp/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [CAMEO172](https://wordpress.org/support/users/cameo172/)
 * (@cameo172)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/template-tweaks/#post-7010390)
 * please, tell me more about the tweak !
    I don’t want to make my own template 
   but with the good method (and not loose it each time their is an update)
 *  [Serge](https://wordpress.org/support/users/gholem/)
 * (@gholem)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/template-tweaks/#post-7010429)
 * I’m curious as well. Maybe we missed some directions somewhere along the lines?
 *  [Mohammad Jangda](https://wordpress.org/support/users/batmoo/)
 * (@batmoo)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/template-tweaks/#post-7010440)
 * If you have a custom theme or your own child theme, then yes, they can go in 
   functions.php. (If your theme is from the Theme Directory or one that has updates,
   you don’t want to do this since you will lose the changes if you update the themes.)
 * Alternatively, you can add them to mu-plugins or your own custom plugin.
 *  Thread Starter [CAMEO172](https://wordpress.org/support/users/cameo172/)
 * (@cameo172)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/template-tweaks/#post-7010441)
 * Thanks for your answer..this is strange cause I have for example some functions
   for W3total cache that are not active in AMP theme…
 * byt the way, can we imagine that the functionn will be in a particular file (
   in a /amp folder for example), on order to separate functions from the regular
   theme from functions for AMP theme ?
 *  [interstice](https://wordpress.org/support/users/interstice/)
 * (@interstice)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/template-tweaks/#post-7010455)
 * Yes, can we make a ../[theme-folder]/amp/functions.php file? this doesn’t seem
   to work without further customization… or how do you recommend we create functions
   that only affect AMP pages? can we use is_amp_endpoint ? if so, how?
 *  [interstice](https://wordpress.org/support/users/interstice/)
 * (@interstice)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/template-tweaks/#post-7010460)
 * 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](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…
 *  Thread Starter [CAMEO172](https://wordpress.org/support/users/cameo172/)
 * (@cameo172)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/template-tweaks/#post-7010461)
 * Interstice,
 * I really want to tweak the template but for now this is urgent to wait a final
   version. This is not hurry as AMP page works but yes, I think we need a particular
   functions.php ou some hook in order to prepare our own single and post template
   specially for AMP.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Template tweaks’ is closed to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

 * 7 replies
 * 4 participants
 * Last reply from: [CAMEO172](https://wordpress.org/support/users/cameo172/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/template-tweaks/#post-7010461)
 * Status: not resolved