Skip to content

Instantly share code, notes, and snippets.

View MohammedKaludi's full-sized avatar

Mohammed Kaludi MohammedKaludi

View GitHub Profile
@MohammedKaludi
MohammedKaludi / gist:3840ab3cf52851148c01c28b73e56c1d
Last active January 3, 2017 12:50
Remove existing AMP analytics
add_action('init','ampforwp_remove_existing_analytics');
function ampforwp_remove_existing_analytics() {
remove_action('amp_post_template_footer','ampforwp_analytics',11);
}
function ampforwp_clicky_analytics() { ?>
<amp-analytics type="clicky">
<script type="application/json">
{
"vars": {
"site_id": "YOUR_SITE_ID_HERE"
}
}
</script>
</amp-analytics>
@MohammedKaludi
MohammedKaludi / gist:435536072d98412f64f9a8023b2795d8
Created December 23, 2016 14:41
AMP Custom Banner: Complete Extension
<?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
*/
@MohammedKaludi
MohammedKaludi / gist:583f78d43251ad9dbb4e3e83de8ec50c
Created December 23, 2016 14:15
AMP Custom Banner Extension : Styling
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 }
@MohammedKaludi
MohammedKaludi / gist:886da4067a9e71b80379d29eee5421e2
Last active December 23, 2016 14:40
AMP Custom Banner Extension : before styling
<?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
*/
@MohammedKaludi
MohammedKaludi / gist:a951d09b883ca543261b439d0c232eff
Last active December 23, 2016 12:37
Custom banner extension : Custom banner code
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>
@MohammedKaludi
MohammedKaludi / gist:31e577ecf37b327bf5048191793234b1
Created December 23, 2016 11:58
Custom banner extension: plugin header
<?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
*/