WP with amp-next-page – problems with Addthis, scrollto, adsense
-
I have a problem with amp-next-page.
I am trying to implement this code in two ways.Depending on the implementation method, the following errors appear.
FIRST METHOD
When I override the amp legacy footer.php template by creating amp directory in my active theme child, adding footer.php file to it and adding <amp-next-page> to the footer.php like this:<amp-next-page> <script type="application/json"> <?php echo wp_json_encode( $amp_next_page ); ?> </script> <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> </amp-next-page>
the following errors appear:
As you scroll, the next page is loaded, the page-url in the address bar is changed BUT:
1) addthis floating buttons share only first page
2) jump (scrollto) to the content works properly only on the first and on the second page and does not work properly on the following pages (it jumps up to the middle of second page)
3) the footer with “back to top” appears only once after loading all pages (which is correct as I suppose?)
4) adsense are loading only on the first page (I’m using Advanced Ads plugin with AMP Auto Ads Enabled)SECOND METHOD
In this method I am implementing amp-next-page code inside my custom plugin with this code:add_action( 'amp_post_template_footer', function ( $amp_template ) { ?> . . . <amp-next-page> <script type="application/json"> <?php echo wp_json_encode( $amp_next_page ); ?> </script> </amp-next-page> <?php } );
the following errors appear:
As you scroll, the next page is loaded, the page-url in the address bar is changed
1) addthis floating buttons share correctly on every page (!!!)
BUT:
2) jump (scrollto) to the content works properly only on the first and on the second page and does not work properly on the following pages (it jumps up to the middle of second page)
3) the footer with “back to top” appears on all loading pages and works properly ONLY on the first and second pages – on the next pages it always jumps to the second page (same second page as “jump to the content”)
4) adsense are loading only on the first page (I’m using Advanced Ads plugin with AMP Auto Ads Enabled)How can I implement amp-next-page and have:
1) addthis floating buttons share correctly on every page (! works only on the SECOND method)
2) jump (scrollto) to the content works properly on every page
3) the footer with “back to top” appears only once after loading all pages (works only on the FIRST METHOD)
4) adsense on every page???
- The topic ‘WP with amp-next-page – problems with Addthis, scrollto, adsense’ is closed to new replies.