vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Mini Mods - A Neater Google Adsense After First Post (https://vborg.vbsupport.ru/showthread.php?t=241944)

ifitsmedia 08-06-2010 12:14 AM

Brilliant, thank you.

spinnaker 01-06-2011 07:50 AM

1 Attachment(s)
How to add advertisement after last post on the page? It's simple :)

DEMO here.

You have to make a small change in the pasted code in Postbit Legacy Template (postbit_legacy) (on the color green).

Code:

<vb:if condition="$post['islastshown']">
<li class="firstpost_advert_container"><div class="firstpost_advert">
      REPLACE THIS WITH YOUR ADSENSE CODE HERE
</div>
</li>
</vb:if>


If you want to have two advertisements simultaneously, the advertisement after the first post and the one after the last, paste this into the previous one. Postbit Legacy Template (postbit_legacy) should look like this (paste this code at the end):

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>

<vb:if condition="$post['islastshown']">
<li class="firstpost_advert_container"><div class="firstpost_advert">
      REPLACE THIS WITH YOUR OTHER ADVERTISEMENT CODE HERE
</div>
</li>
</vb:if>


When using this code, advertisement after the last post using the same code CSS Template (additional.css) for the first advertisement. Don't change anything in CSS Template. But when changing CSS Template for second advertisement (after last post) must add this code to CSS Template (paste at the end in additional.css)

Code:

.lastpost_advert_container {
    clear: both;
    display: block;
    float: left;
    margin-bottom: 12px;
    position: relative;
    width: 100%;
    border: 1px solid #E5E6F4;
}

.lastpost_advert {
    with: 100%;
    background: #F1F1FA;
    border: 1px solid #fff;
    min-height: 90px;
    margin: 0;
    padding: 7px;
    text-align: center;
    vertical-align: middle;
}


and change in Postbit Legacy this green text:

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>

<vb:if condition="$post['islastshown']">
<li class="lastpost_advert_container"><div class="lastpost_advert">
      REPLACE THIS WITH YOUR OTHER ADVERTISEMENT CODE HERE
</div>
</li>
</vb:if>


DEMO here.

Happy New Year :)

rtyagis 01-06-2011 09:20 AM

Tagged this. For ad in the last post.:up:

4x4Ham 01-10-2011 08:07 PM

Thank you. Added with edits for groups in post #11. Works great.

jnrdavo 01-17-2011 09:48 PM

Hi Guys, not sure what I'm doing wrong, but can't get anything to display (in either first post or last post)..

This is the bottom of my postbit_legacy template

{vb:raw template_hook.postbit_end}

<vb:if condition="$post['isfirstshown']">
<li class="firstpost_advert_container"><div class="firstpost_advert">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-753992401340nnnn";
/* slim long one, created 10/18/10 */
google_ad_slot = "444781nnnn";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
</li>
</vb:if>
Am I missing something? I've also modded the additional.css templates...

I'm using 4.1.0 Patch Level 2, any help appreciated.

UPDATE: Ok, so I have this running ok one on board, but the other it only shows if I'm logged out... Obviously something to do with permissiong... Any help still appreciated!

caciocode 01-19-2011 01:47 AM

Tagged. Might come useful

jnrdavo 01-30-2011 05:20 PM

Quote:

Originally Posted by jnrdavo (Post 2150695)
Hi Guys, not sure what I'm doing wrong, but can't get anything to display (in either first post or last post)..

This is the bottom of my postbit_legacy template

{vb:raw template_hook.postbit_end}

<vb:if condition="$post['isfirstshown']">
<li class="firstpost_advert_container"><div class="firstpost_advert">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-753992401340nnnn";
/* slim long one, created 10/18/10 */
google_ad_slot = "444781nnnn";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
</li>
</vb:if>
Am I missing something? I've also modded the additional.css templates...

I'm using 4.1.0 Patch Level 2, any help appreciated.

UPDATE: Ok, so I have this running ok one on board, but the other it only shows if I'm logged out... Obviously something to do with permissiong... Any help still appreciated!

bump... Still looking for help on this one :-)

I would say something to do with permissioning, but can't find out where :-)

webmastersitesi 03-04-2011 02:54 AM

very nice share thank you

BlueCheri 03-04-2011 11:23 PM

Very good one, tagged.

cpvrx 03-07-2011 09:36 PM

It displays the adsense on the first post, of each page correct? Like, if the thread has multiple pages, does it still show up?


All times are GMT. The time now is 04:55 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01185 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete