Created
April 17, 2019 05:21
-
-
Save westonruter/99d365ca3127796c6f05fe4084081aac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Try AMP CTA | |
*/ | |
add_filter( | |
'the_content', | |
function ( $content ) { | |
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) { | |
$content = '<p>CTA!</p>' . $content; | |
} | |
return $content; | |
}, | |
1000 | |
); | |
add_action( | |
'wp_footer', | |
function() { | |
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) { | |
?> | |
<amp-user-notification | |
layout="nodisplay" | |
id="amp-user-notification1" | |
data-dismiss-href="https://foo.com/api/dismissed"> | |
This site uses cookies to personalize content. | |
<a href="">Learn more.</a> | |
<button on="tap:amp-user-notification1.dismiss">I accept</button> | |
</amp-user-notification> | |
<?php | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment