我正试图在我的Wordpess帖子上的特定点动态加载Adsense - 就在每个帖子的wysiwyg文本区域内手动插入div类之前 . 到目前为止,我已经使用了以下内容......

<?php wp_enqueue_script( 'jquery' ); ?>

在wp_head之前,之后:

<script type="text/javascript">
jQuery(document).ready(function($){
$(".example-div").before("Here is the content");
});
</script>

在上面的示例中,像“here is the content”这样的纯文本加载到所需的位置,但是当我插入Adsense代码时它不起作用 .

<script type="text/javascript">
jQuery(document).ready(function($){
$(".example-div").before("<script type="text/javascript"><!--
google_ad_client = "ca-pub-************";
/* Ad ID */
google_ad_slot = "********";
google_ad_width = 320;
google_ad_height = 50;
//-->
</script>
<script type="text/javascript"
src="//pagead2.googlesyndication.com/pagead/show_ads.js">
</script>");
});
</script>

任何关于需要什么样的修改的建议 - 或者出现Adsense代码的最佳方式 - 都非常感激 .