Show comments
';
}
return $vuukle_html;
}
add_filter( 'amp_post_template_data', 'ampforwp_add_vuukle_scripts' );
function ampforwp_add_vuukle_scripts( $data ) {
global $redux_builder_amp;
$display_comments_on = "";
$display_comments_on = ampforwp_get_comments_status();
if ( 4 != $redux_builder_amp['amp-design-selector']
&& isset($redux_builder_amp['ampforwp-vuukle-comments-support'])
&& $redux_builder_amp['ampforwp-vuukle-comments-support']
&& $display_comments_on && comments_open()
) {
if ( empty( $data['amp_component_scripts']['amp-iframe'] ) ) {
$data['amp_component_scripts']['amp-iframe'] = 'https://cdn.ampproject.org/v0/amp-iframe-0.1.js';
}
if ($redux_builder_amp['ampforwp-vuukle-Ads-before-comments']==1
&& empty( $data['amp_component_scripts']['amp-ad'] ) ) {
$data['amp_component_scripts']['amp-ad'] = 'https://cdn.ampproject.org/v0/amp-ad-0.1.js';
}
}
return $data;
}
//spotim #2076
add_action('ampforwp_post_after_design_elements','ampforwp_spotim_comments_support');
function ampforwp_spotim_comments_support() {
global $redux_builder_amp;
if ( 4 != $redux_builder_amp['amp-design-selector']
&& isset($redux_builder_amp['ampforwp-spotim-comments-support'])
&& $redux_builder_amp['ampforwp-spotim-comments-support']==1
) {
echo ampforwp_spotim_comments_markup();
echo "called";die;
}
}
function ampforwp_spotim_comments_markup() {
global $post, $redux_builder_amp;
$display_comments_on = false;
$display_comments_on = ampforwp_get_comments_status();
if (! $display_comments_on ) {
return '';
}
$spotId ='';
if( isset($redux_builder_amp['ampforwp-spotim-comments-apiKey']) && $redux_builder_amp['ampforwp-spotim-comments-apiKey'] !== ""){
$spotId = $redux_builder_amp['ampforwp-spotim-comments-apiKey'];
}
$srcUrl = 'https://amp.spot.im/production.html?';
$srcUrl = add_query_arg('spotId' ,get_permalink(), $srcUrl);
$srcUrl = add_query_arg('postId' , $post->ID, $srcUrl);
$spotim_html = '
Load more...
';
return $spotim_html;
}
//spotim script
add_filter( 'amp_post_template_data', 'ampforwp_add_spotim_scripts' );
function ampforwp_add_spotim_scripts( $data ) {
global $redux_builder_amp;
$display_comments_on = "";
$display_comments_on = ampforwp_get_comments_status();
if ( 4 != $redux_builder_amp['amp-design-selector']
&& isset($redux_builder_amp['ampforwp-spotim-comments-support'])
&& $redux_builder_amp['ampforwp-spotim-comments-support']
&& $display_comments_on && comments_open()
) {
if ( empty( $data['amp_component_scripts']['amp-iframe'] ) ) {
$data['amp_component_scripts']['amp-iframe'] = 'https://cdn.ampproject.org/v0/amp-iframe-0.1.js';
}
}
return $data;
}
//spotim css
add_action('amp_post_template_css','ampforwp_spotim_vuukle_styling',60);
function ampforwp_spotim_vuukle_styling(){
global $redux_builder_amp;
$display_comments_on = "";
$display_comments_on = ampforwp_get_comments_status();
if ( isset($redux_builder_amp['ampforwp-spotim-comments-support'])
&& $redux_builder_amp['ampforwp-spotim-comments-support']
&& $display_comments_on && comments_open() ) {
?>.spot-im-amp-overflow {
background: white;
font-size: 15px;
padding: 15px 0;
text-align: center;
font-family: Helvetica, Arial, sans-serif;
color: #307fe2;
}
.afwp-vuukle-support{
display: block;text-align: center;background: #1f87e5;color: #fff;border-radius: 4px;
} ';
}
// Function to check if the query and the post name are same #2361
function ampforwp_is_query_post_same($haystack = '' , $needle = ''){
$result = '';
if(!empty($haystack) && !empty($needle)){
$result = strpos($haystack ,$needle);
}
if( ($result != false || is_int($result)) && !empty($result) ){
return true;
}
return false;
}
// rel="next" & rel="prev" pagination meta tags #2343
add_action( 'amp_post_template_head', 'ampforwp_rel_next_prev' );
function ampforwp_rel_next_prev(){
global $paged;
if ( get_previous_posts_link() ) { ?>
' . $content . '';
$content = $content . '';
$content = $content . '';
return $content;
}
// Content Sneak Peek Scripts css
function ampforwp_sneak_peek_css(){
global $redux_builder_amp;
$height = $txt_color = $btn_color = '';
$height = $redux_builder_amp['content-sneak-peek-height'];
$btn_color = $redux_builder_amp['content-sneak-peek-btn-color']['color'];
$txt_color = $redux_builder_amp['content-sneak-peek-txt-color']['color'];?>
.fd-h{height: ;overflow: hidden;}
.fd-b-c{text-align: center;}
.fd-b-c .fd-b {border: 1px solid #93abbc;border-radius: 5px;color: ;font-size: 16px;font-weight: 700;line-height: 24px;padding: 8px 5px;width: 250px;background-color: ; }
array(),
'AMP_Blacklist_Sanitizer' => array(),
'AMP_Style_Sanitizer' => array(),
'AMP_Video_Sanitizer' => array(),
'AMP_Audio_Sanitizer' => array(),
'AMP_Iframe_Sanitizer' => array(
'add_placeholder' => true,
),
)
)
);
$content = $sanitizer_obj->get_amp_content();
return $content;
}
// Instant Articles Meta Box
add_action( 'add_meta_boxes', 'ampforwp_ia_meta_box' );
if ( ! function_exists('ampforwp_ia_meta_box') ) {
function ampforwp_ia_meta_box() {
global $redux_builder_amp, $post;
$user_level = '';
$user_level = current_user_can( 'manage_options' );
if ( isset( $redux_builder_amp['amp-meta-permissions'] ) && $redux_builder_amp['amp-meta-permissions'] == 'all' ) {
$user_level = true;
}
if ( $user_level ) {
if( true == $redux_builder_amp['fb-instant-article-switch'] && $post->post_type == 'post' ) {
add_meta_box( 'ampforwp_ia_meta', __( 'Show Instant Article for Current Post?','accelerated-mobile-pages' ), 'ampforwp_ia_meta_callback', 'post','side' );
}
}
}
}
// Callback function for Instant Articles Meta Box.
function ampforwp_ia_meta_callback( $post ) {
global $redux_builder_amp;
wp_nonce_field( basename( __FILE__ ), 'ampforwp_ia_nonce' );
$ampforwp_stored_meta = get_post_meta( $post->ID );
if ( ! isset($ampforwp_stored_meta['ampforwp-ia-on-off'][0]) || $ampforwp_stored_meta['ampforwp-ia-on-off'][0] == 'hide-ia') {
$exclude_post_value = get_option('ampforwp_ia_exclude_post');
if ( $exclude_post_value == null ) {
$exclude_post_value[] = 0;
}
if ( $exclude_post_value ) {
if ( ! in_array( $post->ID, $exclude_post_value ) ) {
$exclude_post_value[] = $post->ID;
update_option('ampforwp_ia_exclude_post', $exclude_post_value);
}
}
} else {
$exclude_post_value = get_option('ampforwp_ia_exclude_post');
if ( $exclude_post_value == null ) {
$exclude_post_value[] = 0;
}
if ( $exclude_post_value ) {
if ( in_array( $post->ID, $exclude_post_value ) ) {
$exclude_ids = array_diff($exclude_post_value, array($post->ID) );
update_option('ampforwp_ia_exclude_post', $exclude_ids);
}
}
} ?>