I am making this tutorial to show how to add View non-AMP and other things in Header.
So, let’s dig into it.
First, create a Custom plugin, you can just copy this code as well.
After creating a custom plugin, add the code in the header using the hook.
You can copy this code as well(only if you are using Design 2)
add_action('ampforwp_header_top_design2','view_non_amp_header'); function view_non_amp_header(){ ampforwp_view_nonamp(); }
Note: Don’t forget to change the hook name if you are using a different design. You can check the hooks name here: Hooks in Header
You can add other things like text, images etc., as well.
Isn’t it easy? you can do it while having your morning coffee as well.
If you have any queries regarding this feel free to ask.
And don’t forget to leave the feedback if it helps you. 🙂
https://wordpress.org/support/plugin/accelerated-mobile-pages/reviews/
Hi
Thanks for this.
What would I change the
‘ampforwp_header_top_design2’
to if I am using the SWIFT?
Thanks,
Matt
You can use ‘ampforwp_header_top_design4’ for Swift.
Where exactly in the header am I putting this? Am I putting it across the entire website, or is there somewhere within the AmpforWP settings to do this?
Hi Kevin,
It will work only on AMP Pages.
OK. I added to the header and it is within my AMP header now. But, is there a way to change the text? I’d rather it say “View Full Site” or something along those lines. Thank you in advance.
Hi Kevin,
Yes you can change view Non-AMP text in AMP
Go to AMP option panel -> Setting -> Translation Panel -> View Non-AMP Version In this field you can enter the text – https://monosnap.com/file/YMcz7kNsLEEyznWq61VtL0iTjlhoSX
Hi,
I’ve used this custom plugin on other sites, and for the Swift theme I have:
add_action(‘ampforwp_header_top_design4′,’view_non_amp_header’);
function view_non_amp_header(){
ampforwp_view_nonamp();
}
but if I’m planning on using the Newspaper theme for AMP, the design isn’t design4. What would it be?
Thanks!
Hi Cheryl Dimof,
Newspaper is built on design 3 could you please use those hooks and if you have any issues then please let us know and we will personally help you.