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: AMP Custom Banner Extension | |
Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/ | |
Description: Extension made for AMP for WP to add a custom banner after the post content. | |
Version: 1.0 | |
Author: Mohammed Kaludi | |
Author URI: http://ampforwp.com/ | |
License: GPL2 | |
*/ |
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
add_action('ampforwp_after_post_content','amp_custom_banner_extension_insert_banner'); | |
function amp_custom_banner_extension_insert_banner() { ?> | |
<div class="amp-custom-banner-after-post"> | |
<a href="https://ampforwp.com/extensions"> | |
<amp-img | |
src="https://ampforwp.com/wp-content/uploads/2016/12/amp-custom-banner.png" | |
width="728" | |
height="90" | |
alt="AMP Extension page"> | |
</amp-img> |
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
add_action('amp_post_template_css', 'amp_custom_banner_extension_styling'); | |
function amp_custom_banner_extension_styling() { ?> | |
.amp-custom-banner-after-post { | |
text-align: center | |
} | |
<?php } |
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: AMP Custom Banner Extension | |
Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/ | |
Description: Extension made for AMP for WP to add a custom banner after the post content. | |
Version: 1.0 | |
Author: Mohammed Kaludi | |
Author URI: http://ampforwp.com/ | |
License: GPL2 | |
*/ |
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: AMP Custom Banner Extension | |
Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/ | |
Description: Extension made for AMP for WP to add a custom banner after the post content. | |
Version: 1.0 | |
Author: Mohammed Kaludi | |
Author URI: http://ampforwp.com/ | |
License: GPL2 | |
*/ |
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
function ampforwp_clicky_analytics() { ?> | |
<amp-analytics type="clicky"> | |
<script type="application/json"> | |
{ | |
"vars": { | |
"site_id": "YOUR_SITE_ID_HERE" | |
} | |
} | |
</script> | |
</amp-analytics> |
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
add_action('init','ampforwp_add_clicky_analytics_hook'); | |
function ampforwp_add_clicky_analytics_hook() { | |
add_action('amp_post_template_footer','ampforwp_clicky_analytics',11); | |
} |
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
add_action('init','ampforwp_remove_existing_analytics'); | |
function ampforwp_remove_existing_analytics() { | |
remove_action('amp_post_template_footer','ampforwp_analytics',11); | |
} |
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 | |
// Remove all the existing analytics code | |
add_action('init','ampforwp_remove_existing_analytics'); | |
function ampforwp_remove_existing_analytics() { | |
remove_action('amp_post_template_footer','ampforwp_analytics',11); | |
} | |
// Build the markup for Clicky Analytics code | |
function ampforwp_clicky_analytics() { ?> | |
<amp-analytics type="clicky"> |
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
// Search Form | |
function ampforwp_get_search_form() { | |
$form = '<form role="search" method="get" id="searchform" class="searchform" target="_top" action="' . trailingslashit( get_bloginfo('url') ) . '?' . AMP_QUERY_VAR . '"> | |
<div> | |
<label class="screen-reader-text" for="s">' . _x( 'AMP SEARCH:', 'label' ) . '</label> | |
<input type="text" value="' . get_search_query() . '" name="s" id="s" /> | |
<input type="submit" id="searchsubmit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" /> | |
</div> |
OlderNewer