View Full Version : exclude forum in ad code
NarutoFTW
10-31-2015, 05:49 PM
Can someone help me edit the code below to allow me to exclude certain forums? Like exclude forum id: 301.
<vb:if condition="$post['isfirstshown']">
<li class="firstpost_advert_container"><div class="firstpost_advert">
<script type="text/javascript">
google_ad_client = "ca-pub-6546546546546";
google_ad_slot = "6401555550";
google_ad_width = 728;
google_ad_height = 90;
</script>
<!-- 728x90, created 8/7/09 -->
<script type="text/javascript"
src="//pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</li>
</vb:if>
Thanks a lot guys.
TheLastSuperman
10-31-2015, 06:25 PM
<vb:if condition="$forum[forumid] != x">Show this if forum id is not x</vb:if>
If excluding from more than one forum then use an array:
<vb:if condition="!in_array($forum['forumid'], array(1,2,3))">Show this to all forums except forum 1, 2 and 3</vb:if>
TheLastSuperman
10-31-2015, 07:00 PM
Also here is the list of conditionals for vB4:
https://vborg.vbsupport.ru/showthread.php?t=231525
Then I noticed you're doing something with advertising in posts? You can also look at the template conditionals listed in post #2 here:
https://vborg.vbsupport.ru/showpost.php?p=2089159&postcount=2
^ There are more conditional examples in the mod's thread where I help some others out previously, even if you don't use my mod specifically (I need to update it regardless to be more modern etc) the template conditionals posted will give you better ideas on how to use them and hide/show/other code based on tons of conditionals that many don't even know you can use ;).
Edit: This is a link from vbulletin.com as well with slightly older 3.x <if> conditionals, simply apply the new <vb:if> instead and they should work fine as well, basically the same thing you're trying to achieve was outline here long ago: http://www.vbulletin.com/forum/forum/vbulletin-4/vbulletin-4-questions-problems-and-troubleshooting/4010569-how-does-one-exclude-category-forum-threads-from-showing-google-adsense
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.