Home › Forums › Calendar Products › Events Calendar PRO › Adsense units showing in snippet
- This topic has 10 replies, 3 voices, and was last updated 10 years, 1 month ago by
Support Droid.
-
AuthorPosts
-
January 12, 2016 at 8:50 am #1054664
Linda
ParticipantHi, on each individual event I add an adsense unit somewhere in the text. Up until today this was fine and did not show up in the list view of the events calendar (snippet text) however today I updated to the latest version of wordpress and events calendar and now it shows ? Any ideas? How can I avoid this happening?
January 12, 2016 at 9:37 am #1054705Linda
ParticipantSorry…..I know I can add an excerpt to stop this but is there another way which would avoid me having to go into each individual event and doing this? (I dont normally use excerpt) Before the update it just ignored any adsense text and took the text before and after it and this worked well for me.
Thanks again for any help 🙂January 12, 2016 at 5:45 pm #1054912George
ParticipantHey @Linda,
Sorry to hear about this – we can definitely help out, or at least try 🙂
One thing I’m curious about is if this is supposed to be visible on your site – I checked out the link you provided but cannot see the issue you describe, as shown in this screenshot:
If you have temporarily rolled back to earlier versions or something like that, would you mind re-updating or just otherwise ensure this issue is still visible on your site? I am sorry to request this! I know your site is a live, active site. However, if you do this I will be able to see the exact problem.
Thank you,
GeorgeJanuary 13, 2016 at 4:45 am #1055048Linda
ParticipantHi George,
Thanks for getting back to me so quickly.
The issue doesnt occur on every event – it depends how far down the actual event listing I have put the adsense unit. If you scroll down on the main whats-on page to April 2016 you will see the three events under that show part of the adsense code. This is obviously because the adsense units are higher up on those event listings.
I hope that makes sense!January 13, 2016 at 4:47 am #1055050Linda
ParticipantThis reply is private.
January 13, 2016 at 10:56 am #1055463George
ParticipantThanks for this @Linda!
The problem seems to be that the HTML “script” tags specifically are being stripped; everything else seems fine, just these HTML tags.
Now, this partially intentional for security purposes, but allowing script tags may be possible if you add the following code to your theme’s functions.php file:
add_filter( 'tribe_events_excerpt_allowed_html', 'tribe_add_script_tags_filter' );
function tribe_add_script_tags_filter( $allowed_html ) {
​
$base_attrs = array(
'class' => array(),
'id' => array(),
'style' => array(),
);
​
$allowed_html['script'] = $base_attrs;
​
return $allowed_html;
}
Thank you!
GeorgeJanuary 15, 2016 at 6:09 am #1056610Linda
ParticipantThis reply is private.
January 15, 2016 at 9:23 am #1056698George
ParticipantI’m sorry Linda! This is weird because I do not have this error at all…
Any improvement if you just replace the above code with this simpler version?
add_filter( 'tribe_events_excerpt_allowed_html', 'tribe_add_script_tags_filter' );function tribe_add_script_tags_filter( $allowed_html ) {
​
$allowed_html['script'] = array(
'class' => array(),
'id' => array(),
'style' => array(),
);
​
return $allowed_html;
}
Thank you,
GeorgeJanuary 18, 2016 at 3:59 am #1057607Linda
ParticipantHi again
I think I will stick with the excerpt feature as I’m not overly confident amending code.
Thank you anyway for your help, much appreciated
January 18, 2016 at 4:31 pm #1058178George
ParticipantSounds good Linda, thank you for the update. I will close up this thread for now but if other questions, comments, or concerns arise, open a new thread any time!
Cheers,
GeorgeFebruary 18, 2016 at 8:34 am #1076892Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Adsense units showing in snippet’ is closed to new replies.

