Adsense advert after first post?

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.
 

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>
 

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.
 

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?
 

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.
 

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.
 

Inkman

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