Thursday, 3 July 2014

How to show adsence ads in archive posts!

I already explained how to insert adsence ads before post text but after post title!

My friend recently told me that I do not have ads in archive article! When I looked in to it, that was really true!

Hm...
Ads were showned normally on home page! When go to archive and click on month, posts that are showned have ads! But when I click on single post in archive, ads were missing!

So what was the problem?

Problem is itemprop! Because I put my adsence code in section where itemprop = articleBody
and this only shows that code in home page!

<data:post.body/>
        <div style='clear: both;'/> <!-- clear for photos floats -->
      </div>
    <b:else/>
      <div class='post-body entry-content' expr:id='&quot;post-body-&quot; + data:post.id' itemprop='articleBody'>
        <div style='float: left; margin: 10px 10px 10px 0;'>
    &lt;script async src=&quot;//pagead2.googlesyndication.com ...
.
.
</div>

I insert same code in section where itemprop='description articleBody' and now I have ads showned in archive post!

<div class='post-body entry-content' expr:id='&quot;post-body-&quot; + data:post.id' itemprop='description articleBody'>
           <div style='float: left; margin: 10px 10px 10px 0;'>
    &lt;script async src=&quot;//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js&quot;&gt;&lt;/script&gt;
.
.
</div>


As you can see, only difference is description!

 

No comments: