php - How to hide a DIV if title contain stop word -
i want hide div wordpress theme, when stop word appear in post title.
<?php if (in_category('10')) { ?> <div id="adsense-top">the adsense code</div> <?php }else { ?> <?php } ?> + <div id="adsense-bottom">the adsense code</div> - manually inserted
basically, need remove 2 divs post when word present in title.
here simple way acheive in javascript
.
<script type="text/javascript"> var title = document.title; //title of page returned if(title.indexof('stop') !== -1) { //if not found, return -1 document.getelementbyid('adsense-bottom').style.display = 'none'; } </script>
but in php
, need like
<?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 } ?>
hope need add. i'm not sure right place.
Comments
Post a Comment