Version: 1.00, by ShawneyJ
Developer Last Online: Nov 2023
Category: Mini Mods -
Version: 4.0.5
Rating:
Released: 05-05-2010
Last Update: Never
Installs: 190
Template Edits
Re-useable Code Translations
No support by the author.
Ok, so i haven't found any google adsence products for vb 4 yet that sit neatly under your first post only, on every page. Credits to Miko and my self for a few tiny edits.
How To Install
Step.1:
GoTo Postbit Templates>>open postbit_legacy and add at the very bottom:
Code:
<vb:if condition="$post['isfirstshown']">
<li class="firstpost_advert_container"><div class="firstpost_advert">
REPLACE THIS WITH YOUR ADSENSE CODE HERE
</div>
</li>
</vb:if>
Step.2:
GoTo CSS Templates>>open additional.css and add this code:
Feel free to customize to your needs, i had to mess around to suit my custom style. I changed the min-height to 90px for a neater look for 728x90 ads and changed margin-bottom: to 18px. But how the code is above is perfect for Vbulletin 4 Default.
DEMO: Teen Forums
Please Note: im not a coder, i just wanted to share this with others, its VERY easy to add to your styles and looks neat. Good Luck.
This coding is also different than Mod Version: 1.00, by Allan. You shouldn't have any problems with this and it will do you till a product version comes out.
<vb:literal> tag--Just surround Google script with it
Thank you for this great tip. I too get a bit annoyed with the "curly error" and this took care of the problem. I followed spinnaker's suggestion and have AdSense ads displaying after the first post AND after the last post.
Great simple mod that only requires an easy addition of code. Great work!
One last question:
If you have edited the code to display ads on threads both after the first post AND the last post... when a thread is brand new and there is ONLY one post you get two Google AdSense ads back to back. Is there a way to disable the "second" or "last" container so that it does not show an ad if there is only one post in a thread?
Try this, I have not tested the code, so please let me know.
(Alter the post count ($tbworld_postbit_postcount >= 3) to what suits you.)
HTML Code:
// Revised Last Post Advert
<vb:if condition="$post['islastshown'] AND $tbworld_postbit_postcount >= 3"><li class="lastpost_advert_container"><div class="lastpost_advert">
REPLACE THIS WITH YOUR OTHER ADVERTISEMENT CODE HERE
</div></li></vb:if>
Create Plugin to keep track of post counts per page.
PHP Code:
// Hook: postbit_display_complete if (THIS_SCRIPT == 'showthread') { global $tbworld_postbit_postcount; vB_Template::preRegister('postbit_legacy',array('tbworld_postbit_postcount' => ++$tbworld_postbit_postcount)); }
Try this, I have not tested the code, so please let me know.
(Alter the post count ($tbworld_postbit_postcount >= 3) to what suits you.)
HTML Code:
// Revised Last Post Advert
<vb:if condition="$post['islastshown'] AND $tbworld_postbit_postcount >= 3"><li class="lastpost_advert_container"><div class="lastpost_advert">
REPLACE THIS WITH YOUR OTHER ADVERTISEMENT CODE HERE
</div></li></vb:if>
Create Plugin to keep track of post counts per page.
PHP Code:
// Hook: postbit_display_complete
if (THIS_SCRIPT == 'showthread')
{
global $tbworld_postbit_postcount;
vB_Template::preRegister('postbit_legacy',array('tbworld_postbit_postcount' => ++$tbworld_postbit_postcount));
}
Should help.
Where does the PHP code go, at the bottom of additional.css?
So far what i am seeing is that it is no longer showing the "last_post_advert" on single post threads, but it is also not showing it on ones that have 3+ posts.
So what should be happening is that in the "islastshown" conditional, I have added an additional check to see if the post count on that page is equal or greater than 3. If it is not then do not show the ad. Simple.