Support » Plugin: AMP » How can I modify footer.php (amp/templates) with my own plugin or child theme?
How can I modify footer.php (amp/templates) with my own plugin or child theme?
-
Hello,
How can I modify footer.php (amp/templates) with my own plugin or child theme?
I need to add <amp-next-page> code and next-page-hide to the footer tag.
How can I do it??? Is it possible with hook?I have tried to put this file in my plugin or childtheme folder and I have an error with $THIS.
I am using Reader Mode with AMP Legacy.
This is the original file:
<?php /** * Footer template part. * * 🚫🚫🚫 * DO NOT EDIT THIS FILE WHILE INSIDE THE PLUGIN! Changes You make will be lost when a new version * of the AMP plugin is released. You need to copy this file out of the plugin and put it into your * custom theme, for example. To learn about how to customize these Reader-mode AMP templates, please * see: https://amp-wp.org/documentation/how-the-plugin-works/classic-templates/ * 🚫🚫🚫 * * @package AMP */ /** * Context. * * @var AMP_Post_Template $this */ ?> <footer class="amp-wp-footer"> <div> <h2><?php echo esc_html( wptexturize( $this->get( 'blog_name' ) ) ); ?></h2> <a href="#top" class="back-to-top"><?php esc_html_e( 'Back to top', 'amp' ); ?></a> </div> </footer>
- This topic was modified 2 years, 8 months ago by aniads.
-
Thank you, but I have tried this earlier. It didn’t work then.
I had an error.
But now it works. I don’t understand…
Maybe this is because I’ve deleted this:/** * Footer template part. * * 🚫🚫🚫 * DO NOT EDIT THIS FILE WHILE INSIDE THE PLUGIN! Changes You make will be lost when a new version * of the AMP plugin is released. You need to copy this file out of the plugin and put it into your * custom theme, for example. To learn about how to customize these Reader-mode AMP templates, please * see: https://amp-wp.org/documentation/how-the-plugin-works/classic-templates/ * 🚫🚫🚫 * * @package AMP */ /** * Context. * * @var AMP_Post_Template $this */
Is this code required?
ok, please make sure that you have correct path just /amp/ and not
/amp/template/,Also, please share the complete error message and theme (main site theme)
As I said above – now it works. I don’t know why…
Maybe this is because my footer.php has now original code – commented code (earlier I’ve deleted this):
Is this code required?/** * Footer template part. * * 🚫🚫🚫 * DO NOT EDIT THIS FILE WHILE INSIDE THE PLUGIN! Changes You make will be lost when a new version * of the AMP plugin is released. You need to copy this file out of the plugin and put it into your * custom theme, for example. To learn about how to customize these Reader-mode AMP templates, please * see: https://amp-wp.org/documentation/how-the-plugin-works/classic-templates/ * 🚫🚫🚫 * * @package AMP */ /** * Context. * * @var AMP_Post_Template $this */
Hello @aniads
No, the code comment is not required
Thank you.
Now it works, but have found another problems (depending on where & how am I trying to modify the footer). Please have a look here:
https://wordpress.org/support/topic/amp-next-page/Yes, My colleague will respond to you on that topic, in meantime be sure to share your experience using AMP plugin.
I’ll mark this as resolved. Feel free to open a new support topic if you require any further assistance.
- The topic ‘How can I modify footer.php (amp/templates) with my own plugin or child theme?’ is closed to new replies.