Lego2012
12/13/2016 - 4:58 PM

First and second posts only

First and second posts only

<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.

add_action( 'genesis_after_entry', 'google_ad' );
function google_ad() {

    if ( ! ( is_home() || is_category() ) )
        return;

    global $wp_query;
    if( ($wp_query->current_post == 0) || ($wp_query->current_post == 1) ) {
        echo '<div class="adsense">Adsense code here</div>';
    }

}