Add AdSense in Home After Second & Third Posts

Community Forums Forums General Discussion Add AdSense in Home After Second & Third Posts

This topic is: not resolved

Tagged: , , , ,

This topic contains 6 replies, has 5 voices, and was last updated by  genwrock 7 months, 1 week ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #55150

    Pseric
    Participant
    Post count: 3

    Hi,

    I tried to using Genesis Simple Hooks and put the code:

    <?php global $loop_counter;
    if (is_home() && $loop_counter = 2) { ?>
    [AdSense]
    <?php } ?>

    It’s works on 1.9.x, after I upgraded to 2.0.0, it does not works,
    how can I put the AdSense after second or third posts in homepage?

    Thanks!

    http://www.freegroup.org/
    #55198

    Anita
    Participant
    Post count: 7520

    Read this and it may help you – http://www.nathanrice.net/blog/genesis-loop-hooks/. 2.0 with HTML5 active will use different hooks.


    When asking for help, please provide a link or screen shot showing your problem!
    Let me help you customize your theme, responsive header, Buddypress, Agentpress or technical issue!
    Visit me here: Cre8tiveDiva.com | Tweet Me!

    #55202

    braddalton
    Participant
    Post count: 9364

    You will need to update to the latest version of the simple hooks plugin if you have converted your child theme to support HTML 5

    Here’s the update (changelog) for the Genesis Simple Hooks plugin compeleted yesterday.

    2.0.0 Updated to use new entry hooks in Genesis 2.0.

    You could also put that code in to a custom function in your child themes files rather than simple hooks.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #55459

    Pseric
    Participant
    Post count: 3

    Thanks to anitac & Brad,

    I have tried this code:

    add_action( 'genesis_after_entry', 'ad_after_first_post');
    function ad_after_first_post() {
    global $loop_counter;
    if (!is_singular() && $loop_counter == 0) { ?>
    [AdSense]
    <?php }}

    I just want Ads appear after the first post, but it is displayed in every post.

    Please help, thanks!

    #85824

    Manuel
    Participant
    Post count: 8

    Hi Pseric and Brandondalton, do you find the solution for this problem?, i have the same issue, it display in every post

    Thanks!

    #85853

    Pseric
    Participant
    Post count: 3

    Hi Manuel,

    Maybe you can try “Google Publisher Plugin”, it can help you place the AdSense to the right place.

    Google Publisher Plugin

    http://wordpress.org/plugins/google-publisher/

    Regards,
    Pseric

    #85858

    genwrock
    Member
    Post count: 519

    see the code here http://pwdtechnology.com/adding-adsense-home-second-third-posts/


    Working as a freelancer & helping the people on forum | Chinmoy @ PWD | Please Follow Me on Twitter If I’ve helped.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.