Forums

Adsense after first post only (40 posts)

  1. trc49492
    Member
    Posted 6 years ago #

    Yea, like janjalani, I just want to put an adsense block within just the first two posts on the main blog page and then on the single page (permalink pages) have the adsense block always displayed within the post...???

  2. luiscamino
    Member
    Posted 6 years ago #

    i've used this code in a couple of websites without any problem but now i have a website with two wp installations (two languages) and it works in the spanish one but not in the english one! i have revised the code around it and in the header of the template a dozen times and they look identical! take a look:

    http://www.clubsonyericsson.com/es
    http://www.clubsonyericsson.com/en

  3. remdog
    Member
    Posted 6 years ago #

    Cool it worked. I used the code that was in the near the beginning of this thread. I now have my adsense code between posts 1 and 2. How would I tweak the code to have the "adsense code" appear between posts 2 and 3 ALSO.... ??

    Thanks

  4. remdog
    Member
    Posted 6 years ago #

    Ok this is what I actually have in my index. I can change the $showads to any number I want to indicate which post to show the Ads after. But, I want to show it after post 1 and after 2...

    I can't seem to find this anywhere.. ideas??

    <?php
    get_header();
    ?>

    <?php $postnum = 1; $showads = 1; ?>

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div class="post">

    <h3 class="storytitle" id="post-<?php the_ID(); ?>"><div id=docimage></div>" rel="bookmark"><?php the_title(); ?></h3>
    <div class="meta"><?php _e("Filed under"); ?> <?php the_category(',') ?> <?php _e('by')?> <?php the_author() ?> on <?php the_time('l F j, Y'); ?> <?php edit_post_link(__('Edit This')); ?></div>

    <div class="storycontent">
    <?php the_content(__('(more...)')); ?>
    </div>

    <div class="feedback">
    <?php wp_link_pages(); ?>
    ">Trackback · <?php comments_popup_link(__('No comments yet'), __('1 comment'), __('% comments')); ?>
    </div>

    <?php trackback_rdf(); ?>

    </div>

    <?php comments_template(); // Get wp-comments.php template ?>

    <?php if ($postnum == $showads) { ?> ADSENSE CODE HERE <?php } $postnum++; ?>

    <?php endwhile; else: ?>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    <?php endif; ?>
    <div class="feedback"><?php posts_nav_link(' — ', __('« previous page'), __('next page »')); ?></div>

    <?php get_footer(); ?>
    <br><br>

  5. remdog
    Member
    Posted 6 years ago #

    hmmm... maybe it isn't possible. I thought I saw this on another WordPress script but maybe it was a different script...

  6. Pavlos
    Member
    Posted 5 years ago #

    I tried the original solution on this thread, as proposed by Techgnome here.

    Of course implementing them at the corresponding parts of the new loop, in index.php

    However, although my Google Ads do appear fine between the first and second posts, they do NOT appear on my sidebar or footer. If I remove the code, my sidebar and footer ads show up fine.

    In particular there should be google links at the footer and a vertical google ad on the sidebar, as well as a half banner google ad at the top-right hand box. That's 3 ads, and 1 link, exactly what adsense allows...

    So I cannot understand why they show alternate (amazon) ads instead, or nothing (in the case of the sidebar box, where I don't have alternate ads enabled).

    If you visit an individual post's page (making use of a single.php file not including the $showAdSense solution), everything displays as it is meant to.

    I am very confused over this, anyone has any suggestions?

    You can see my blog here. Thanks!

  7. aop1980
    Member
    Posted 5 years ago #

    I have tried almost everything to get ads in the title, under the "Comments" link. When I add the adsense to post.php, it adds it to the first two posts. Any ideas? I just want it on the first post.

    Thanks

  8. opioq
    Member
    Posted 5 years ago #

    I have been looking for this post!
    I am trying to place an adblock above the fisrt post but not above the <div id="content"> which was mentioned earlier, doing that pushes my side colums down. Any suggestions? I would greatly appreciate it.

    I am also seeing ads inside of posts in differant colors.

    You can see my site here to know what I am talking about.

    thanks.

  9. richms
    Member
    Posted 5 years ago #

    I'm trying to do this, but using the adsense deluxe plugin, what ends up happening is that the <!--adsense#bigbox--> just gets put into the resultant page, the plugin doesnt translate it to the actual adsense code.

    Is there soemthing I have to put around this to get it to do the translation or will this never work?

  10. vkaryl
    Member
    Posted 5 years ago #

    No clue.... I don't bother with any of the plugins, I just put the code where it needs to be. I've never seen any point to the plugins.

Topic Closed

This topic has been closed to new replies.

About this Topic