Put Ads Beside The Post Contents Automatically


Last time I wrote a tip on how to put Ads under the post title; and later on this function was implemented by the Blogger team itself. Now to make this ads even further integrated in the post, I will show you how to make one like the above picture.
  1. Go to ‘Layout’ > ‘Edit HTML’ > Tick ‘Expand Widget Templates’
  2. Fin this code: <data:post.body/>
  3. Just before this code, paste your Google AdSense code
    &lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
    google_ad_client=&quot;pub-3896524625048375&quot;;
    google_ad_host=&quot;pub-1556223355139109&quot;;
    google_ad_width=336;
    google_ad_height=280;
    google_ad_format=&quot;336x280_as&quot;;
    google_ad_type=&quot;text_image&quot;;
    google_color_border=&quot;FFFFFF&quot;;
    google_color_bg=&quot;FFFFFF&quot;;
    google_color_link=&quot;D27318&quot;;
    google_color_url=&quot;008000&quot;;
    google_color_text=&quot;560E00&quot;;
    //--&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot;
    src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;
    &lt;/script&gt;




  4. After your code has been parsed, copy it to put in the following format:

    <div align="center">
    <table border="0" cellpadding="0" align="left">
    <tr>
    <td align="center">
    <p align="center">
    put Google ads Here
    </p>
    </td>
    </tr>
    </table>
    </div>


    Replace ‘put Google ads Here’ with your parsed code.


  5. Click ‘SAVE TEMPLATE’


Note: If you just want to show this ad only in single post, use this code: <b:if cond='data:blog.pageType == "item"'> PUT ALL YOUR ABOVE CODE HERE </b:if>


So the final code may look like this:


<b:if cond='data:blog.pageType == "item"'>
<div align="center">
<table border="0" cellpadding="0" align="left">
<tr>
<td align="center">
<p align="center">
&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client=&quot;pub-3896524625048375&quot;;
google_ad_host=&quot;pub-1556223355139109&quot;;
google_ad_width=336;
google_ad_height=280;
google_ad_format=&quot;336x280_as&quot;;
google_ad_type=&quot;text_image&quot;;
google_color_border=&quot;FFFFFF&quot;;
google_color_bg=&quot;FFFFFF&quot;;
google_color_link=&quot;D27318&quot;;
google_color_url=&quot;008000&quot;;
google_color_text=&quot;560E00&quot;;
//--&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;
&lt;/script&gt;
</p>
</td>
</tr>
</table>
</div>
</b:if>



Alternative code you can use:

<div class='post-body entry-content'>
<b:if cond='data:blog.pageType == "item"'>
<div style='float: left;'>
&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;pub-xxxxxxxxxxxxxxxx&quot;;
google_ad_host = &quot;pub-xxxxxxxxxxxxxxxx&quot;;
google_ad_slot = &quot;xxxxxxxxxx&quot;;
google_ad_width = 336;
google_ad_height = 280;
//--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&;quot;&gt;
&lt;/script&gt;
</div>
</b:if>
<p><data:post.body/></p>



SAMPLE:

Ads beside post



If you have any better method, please share with us!

0 comments:

Post a Comment

+/- Click to expand / collapse the Recent Posts