Skip to content

Commit

Permalink
Missing amp-social-share.js frontpage fixed #372
Browse files Browse the repository at this point in the history
Missing amp-social-share.js frontpage fixed #372
  • Loading branch information
MohammedKaludi committed Jan 5, 2017
1 parent 020b58d commit 18d3466
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions templates/features.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,22 +185,27 @@ function ampforwp_change_content_width( $content_max_width ) {
// 6. Add required Javascripts for extra AMP features
add_action('amp_post_template_head','ampforwp_register_additional_scripts', 20);
function ampforwp_register_additional_scripts() {
global $redux_builder_amp;
?><script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<?php if( is_page() ) { ?><script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script><?php } ?>
<script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"></script>
<?php if($redux_builder_amp['amp-enable-notifications'] == true) { ?>
<script async custom-element="amp-user-notification" src="https://cdn.ampproject.org/v0/amp-user-notification-0.1.js"></script>
<?php } ?>
<?php if( $redux_builder_amp['enable-single-social-icons'] == true || AMPFORWP_DM_SOCIAL_CHECK === 'true' ) { ?>
<?php if( is_singular() ) { ?><script async custom-element="amp-social-share" src="https://cdn.ampproject.org/v0/amp-social-share-0.1.js"></script>
<?php } } ?>
<?php if($redux_builder_amp['amp-frontpage-select-option'] == 1) { ?>
<?php if( is_front_page() ) { ?>
<script async custom-element="amp-social-share" src="https://cdn.ampproject.org/v0/amp-social-share-0.1.js"></script>
<?php } } ?>
<script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>
<?php }
global $redux_builder_amp; ?>
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<?php if( is_page() ) { ?>
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
<?php } ?>
<script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"></script>
<?php if($redux_builder_amp['amp-enable-notifications'] == true) { ?>
<script async custom-element="amp-user-notification" src="https://cdn.ampproject.org/v0/amp-user-notification-0.1.js"></script>
<?php } ?>
<?php if( $redux_builder_amp['enable-single-social-icons'] == true || AMPFORWP_DM_SOCIAL_CHECK === 'true' ) { ?>
<?php if( is_singular() ) { ?>
<script async custom-element="amp-social-share" src="https://cdn.ampproject.org/v0/amp-social-share-0.1.js"></script>
<?php }
} ?>
<?php if($redux_builder_amp['amp-frontpage-select-option'] == 1) { ?>
<?php if( is_home() ) { ?>
<script async custom-element="amp-social-share" src="https://cdn.ampproject.org/v0/amp-social-share-0.1.js"></script>
<?php }
} ?>
<script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script><?php
}

// 7. Footer for AMP Pages
add_filter( 'amp_post_template_file', 'ampforwp_custom_footer', 10, 3 );
Expand Down

0 comments on commit 18d3466

Please sign in to comment.