1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Adsense advert after first post?

Discussion in 'Styling and Customization Questions' started by JamesBrown, May 11, 2012.

  1. JamesBrown

    JamesBrown Well-Known Member

    I have found that an advert after the first post is one of the best adsense earners. can someone post an idiots guide to achieving this with with XF. Thanks in anticipation.
     
  2. MattW

    MattW Well-Known Member

  3. Bellinis

    Bellinis Active Member

    And how about an ad as second post that looks like a regular reply? Does such resource exist?
     
  4. Mish

    Mish Member

    Sencond post or maybe after x replies ? Would be great..
     
  5. HenrikHansen

    HenrikHansen Well-Known Member

  6. Mish

    Mish Member

  7. Brogan

    Brogan XenForo Moderator Staff Member

    Check my forum out, I have an advert styled as the second post.

    advert.PNG
     
    HenrikHansen likes this.
  8. Mish

    Mish Member

    Very nice..And you are using "Rotating Ads" addon pointed by HenrikHansen ?
     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    No, just the ad_ templates.

    The above is achieved very simply, like so:
    Code:
    <xen:hook name="ad_message_below" />
     
    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$thread.reply_count} > 0">
        <xen:if is="!{$visitor.user_id}">
            <li class="message">
                <div class="messageUserInfo">
                    <div class="messageUserBlock">
                        <div class="avatarHolder" style="height: 102px; width: 102px">
                            <span class="helper"></span>
                            <img src="http://cliptheapex.com/data/avatars/m/0/2.jpg" alt="Avatar" height="96px" width="96px" style="border: 1px solid #C0C0C0; padding: 2px" />
                        </div>
                        <h3 class="userText">
                        <span style="font-weight: bold">Google AdSense</span>
                        <em class="userTitle" itemprop="title">Guest Advertisement</em>
                        </h3>
                        <span class="arrow"><span></span></span>
                    </div>
                </div>
                <div class="messageInfo primaryContent">
                    <div class="messageContent">
                        <article>
                            <blockquote class="messageText ugc baseHtml">
                                <script type="text/javascript"><!--
                                google_ad_client = "ca-pub-######";
                                /* Message Below */
                                google_ad_slot = "######";
                                google_ad_width = 728;
                                google_ad_height = 90;
                                //-->
                                </script>
                                <script type="text/javascript"
                                src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
                                </script>
                                <br /><br /><label for="LoginControl"><span style="font-weight: bold; color: #004400"><a href="login/" class="concealed noOutline">Log in or Sign up</a></span></label> to hide all adverts.
                            </blockquote>
                        </article>
                    </div>
                </div>
            </li>
        </xen:if>
    </xen:if>
     
  10. SportainmentMG

    SportainmentMG Active Member

    Brogan is there a way to use the Rotating Ads addon listed above with your set up as yours looks allot better.
     
  11. Brogan

    Brogan XenForo Moderator Staff Member

    I don't use that add-on so you will need to ask the developer or post in the add-on discussion thread.
     
  12. Inkman

    Inkman Active Member

    Hi Brogan. Sorry to post in this thread after so long. I am just wondering if you could tell me what template i should put that code in please?
     
  13. Brogan

    Brogan XenForo Moderator Staff Member

    ad_message_below
     
  14. Inkman

    Inkman Active Member

    I put it in there but it didnt show on my forum :s
     
  15. Brogan

    Brogan XenForo Moderator Staff Member

    It shows to guests only.

    You also need to edit it to add your own AdSense code.
     
  16. Inkman

    Inkman Active Member

    Ahh i see, would you know if there is away to keep it there for all members to view?
     
  17. Brogan

    Brogan XenForo Moderator Staff Member

    Remove the guest conditional <xen:if is="!{$visitor.user_id}"> ... </xen:if>
     
  18. Inkman

    Inkman Active Member

    Cant seem to find that in the code, sorry new to this software only purchased it today from you.
    Could you possibly post the code i would need please and if possible remove the Google sense so i could just add a click-able image. I would really appreciate it.
    Sorry to be a pain.
     
  19. Brogan

    Brogan XenForo Moderator Staff Member

    HTML:
    <xen:hook name="ad_message_below" />
     
    <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$thread.reply_count} > 0">
        <li class="message">
            <div class="messageUserInfo">
                <div class="messageUserBlock">
                    <div class="avatarHolder" style="height: 102px; width: 102px">
                        <span class="helper"></span>
                        <img src="http://cliptheapex.com/data/avatars/m/0/2.jpg" alt="Avatar" height="96px" width="96px" style="border: 1px solid #C0C0C0; padding: 2px" />
                    </div>
                    <h3 class="userText">
                    <span style="font-weight: bold">Google AdSense</span>
                    <em class="userTitle" itemprop="title">Guest Advertisement</em>
                    </h3>
                    <span class="arrow"><span></span></span>
                </div>
            </div>
            <div class="messageInfo primaryContent">
                <div class="messageContent">
                    <article>
                        <blockquote class="messageText ugc baseHtml">
                            Your advert here
                        </blockquote>
                    </article>
                </div>
            </div>
        </li>
    </xen:if>
    Replace Your advert here with your image or whatever you want.
     
    Jattitude, TsinJu and MattW like this.
  20. Inkman

    Inkman Active Member

    Thanks very much. I have just added that code and no advert is showing or anything in threads :s
     

Share This Page