Support » Fixing WordPress » adding adsense after 1st post on frontpage

  • I am trying for some time to add a adsense block after the 1st post on the frontpage.

    Now I have looked on the internet how to do it and they didnt work.

    I also tried to use plug in such as ads easy, ad injection and frontpage banner.

    So far non of them works.

    I am using the NewsMagazine Theme and my page.php looks as follow:

    <?php global $theme; get_header(); ?>
    
        <div id="main">
    
            <?php $theme->hook('main_before'); ?>
    
            <div id="content">
    
                <?php $theme->hook('content_before'); ?>
    
         <script type="text/javascript"><!--
    google_ad_client = "**************";
    /* _ */
    google_ad_slot = "********";
    google_ad_width = 468;
    google_ad_height = 15;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
                <?php
                    if (have_posts()) : while (have_posts()) : the_post();
    <?php $count = 1; ?>
                        /**
                         * Find the post formatting for the pages in the post-page.php file
                         */
                        get_template_part('post', 'page');
    
    <?php if ($count == 1) : ?>
    <script type="text/javascript"><!--
    google_ad_client = " ";
    /* textblok */
    google_ad_slot = " ";
    google_ad_width = 336;
    google_ad_height = 280;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    <?php endif; $count++; ?>
                        if(comments_open( get_the_ID() ))  {
                            comments_template('', true);
                        }
                    endwhile;
    
                    else :
                        get_template_part('post', 'noresults');
                    endif;
                ?>
    
                <?php $theme->hook('content_after'); ?>
    
            </div><!-- #content -->
    
            <?php get_sidebars(); ?>
    
            <?php $theme->hook('main_after'); ?>
    
        </div><!-- #main -->
    
    <?php get_footer(); ?>

    I hope someone can tell me how to add the adsense after the 1st post.

    ps. the first adsense code is for a horizontal banner above the 1st post which is working.

Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘adding adsense after 1st post on frontpage’ is closed to new replies.