这是一个简单的方法来实现这一点Javascript
。
<script type="text/javascript">
var title = document.title; //title of the page is returned
if(title.indexOf('stop') !== -1) { //If not found, it will return -1
document.getElementById('adsense-bottom').style.display = 'none';
}
</script>
但是在php
,你需要这样做
<?php if (in_category('10')) { ?>
<div id="adsense-top">the adsense code</div>
<?php }else { ?>
<script type="text/javascript">
var title = document.title;
if(title.indexOf('stop') !== -1) {
document.getElementById('adsense-bottom').style.display = 'none';
}
</script>
<?php } ?>
希望像这样你需要添加。我不确定这是不是正确的地方。