Jump to content
zouleo

<script> As Allowed Tags In Excerpt Doesn't Work

Recommended Posts

zouleo    1
zouleo

I'm trying to put an adsense ad in an excerpt. I've added <script> as an allowed tag in the Pagelines settings. But it is removed anyway. What could be wrong? I'm not using any plugin that could interfere. And other text in excerpt is not removed.

Share this post


Link to post
Share on other sites
Danny    1,327
Danny

Hi,

I have to be honest and say that I have never tried to add javascript to an excerpt that way before. However, without evening trying, I don't think it would work, as javascript isn't HTML.

I would recommend you use a hook, to add your adsense to excerpts.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
zouleo    1
zouleo

I'm already adding the adsense code using a hook.


add_filter('the_content', 'appendAdSense');

function appendAdSense ($text) {

 if (is_archive()) {

 return $text . '<script type="text/javascript">...adsense code here...</script>';

 }

 return $text:

}


But the adsense code always is removed. Why?

Share this post


Link to post
Share on other sites
Jenny    33
Jenny

You can also try using a plugin from wordpress. Several of them have options to add ad units to excerpts. Ad Injection I think is one of them.


Jenny :: Web designer at Simple Mama (follow me at @simplemamacom)

Check out Share Me, a social sharing add-on for DMS that is super simple to set up.

Share this post


Link to post
Share on other sites
zouleo    1
zouleo

Yes. But the problem seems to be in PageLines...

Share this post


Link to post
Share on other sites
Simon    247
Simon

You need to use an action not a filter.

pagelines_loop_after_excerpt


add_action( 'pagelines_loop_after_excerpt', 'appendAdSense' );
function appendAdSense() {
echo '<script type="text/javascript">...adsense code here...</script>';
}

[/CODE]

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×