Vbulletin is a very powerful and the best Forum software available for ordinary use. It is written in PHP and uses a SQL database server. Recently a friend of mine create an online Forum for mobile users and he is using Vbulletin for it. His Forum is just amazing and i can now feel the power of Vbulletin.
But yesterday he asked me about adding Adsense Ads to his Forum and the answer to this is not as simple as it seems. In order to add Adsense Code to you forum you will have to login as administrator.
A list of best alternatives to bluetsacks
Before proceeding you have to save all data from "postbit_legacy" to be sure that everything that you perform on your Vbulletin will be safe and perfect.
Adding Ad After the First Post
In order to add Adsense AD after the first post follow the steps:
- Now click on the search in temple.
- Type postbit_legacy and then click on the find button.
- Now double click on the postbit legacy and go to a very bottom of your page.
- Add the code below and put your AdSense code inside it.
- And then click on the save button.
<vb:if condition="$post['isfirstshown']"> <li class="firstpost_advert_container"><div class="firstpost_advert"> Your Google Adsense code here </li> </vb:if>
Adding Adsense Ad After any X posts
All the steps will remain same but we will just replace the the above code with the code given below. In the code given below replace X with the number of posts after which you want your ad to be displayed.
<vb:if condition="$show[guest] AND $post[postcount] % $vboptions[maxposts] == X"> <li class="firstpost_advert_container"><div class="firstpost_advert"> Your Google Adsense code here </li> </vb:if>
Centering and coloring the ads
Now Go to Styles & Templates>Search in Templates>your style then search for additional.css and anywhere add :
.firstpost_advert_container { clear: both; display: block; float: left; margin-bottom: 12px; position: relative; width: 100%; border: 1px solid #E5E6F4; } .firstpost_advert { with: 100%; background: #F1F1FA; border: 1px solid #fff; min-height: 90px; margin: 0; padding: 7px; text-align: center; vertical-align: middle; }
There is some risk associated with customization so do this at your own risk and I am not responsible to any of the loss. I have tried these myself , so worries. If you are still facing any problem do comment here.
Related Post: iPhone 7 Concept Video That is Too Real to be True