我喜歡在類別,存檔,標籤&搜索頁面上的WordPress網站上插入adsense。這是我能在網上找到的最接近的解決方案:在WordPress的類別,檔案,標籤和搜索頁面插入廣告
<?php $postcounter = 1;
if (have_posts()) : ?>
<?php while (have_posts()) : $postcounter = $postcounter + 1;
the_post(); ?>
<?php if(4 == $postcounter)
{ echo ' <div id="adsbetween">
<center> YOUR_ADSENSE_CODE </center>
</div> ' ;
} ?>
我需要將相同的與我有什麼在我下面的主題幫助:
if (($cat_layout == 'masonry-3') || ($cat_layout == 'masonry-2')) {
echo '<div class="module-masonry-wrapper clear-fix">';
echo '<div class="masonry-content-container">';
while (have_posts()): the_post();
echo kid_masonry_render(get_the_ID());
endwhile;
echo '</div></div>';
這裏是另一個例子:
echo '<div class="classic-blog-content-container">';
while (have_posts()): the_post();
echo kid_classic_blog_render(get_the_ID(), 35);
endwhile;
echo '</div>';
代碼在第四次上市後應該刊登ADSENSE_CODE。
任何幫助?
嘗試刪除'$ postcounter = $ postcounter + 1;',把'$ postcounter ++;'前'ENDWHILE;' – X9DESIGN