Add Adsense in Home only in the first post

Community Forums Forums Design Tips and Tricks Add Adsense in Home only in the first post

This topic is: not resolved

Tagged: ,

This topic contains 3 replies, has 3 voices, and was last updated by  Manuel 2 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #50576



    I tried to add adsense in the home page, but only in the first post, i know is a loop but i need to add a banner only in the first post, not in all the post, this is the code I tried:

    function wpsites_display_adsense_home2() {
        echo '<center><div class="adsense-home"><script type="text/javascript"><!--
    					google_ad_client = "pub-4646869510923718";
    					/* brujeria blanca 350x250 */
    					google_ad_slot = "1998849211";
    					google_ad_width = 300;
    					google_ad_height = 250;
    				<script type="text/javascript"
    		<center><strong>Enlace Patrocinado</strong></center></div></center>';
    add_action('genesis_before_post_title', 'wpsites_display_adsense_home2', 5 );

    Thanks in advanced!



    You are using a code from Brad Dalton ( You might want to post your question over to him.



    I did write about this on my blog as well as answer a question on these forums which provides the solution however i cannot find it.

    Basically it uses a conditional tag for the home page and some other code so it only displays the content on the first post which changes as soon as your publish a new one.



    Do you know where i cant find those variables to create that conditional, I already tried different conditionals, but without success.

    I know I need to insert the adsense code after the id=”content”, or only execute the code in the first post

    Brandon, Can you recommend me a tutorial where i can learn how to use the genesis framework, please!


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

You must be logged in to reply to this topic.