showing Ads above featured image on first page

Posted in: Newspaper
Post count: 28

Hey Guys,

I am using pagination for my posts , and using the default template loop-single.php

what I would like to achieve is to have a piece of code for header Ad ( <?php echo do_shortcode(‘[td_ad_box spot_id=”header”]’); ?> ) to only show on the first page above the featured image , and I don’t want it to show on the second and third pages (where the featured image doesn’t show) …

so basically I want to tie up the header Ad to show and hide with the featured image ..

Again , I am using the default post Template and happy to play with code if you provide me with guidance ..

Cheers

Wissam

Post count: 7909

Hi,

Add this code in loop-single.php above featured image: http://screencast.com/t/RVmFcvkV

<?php $page = get_query_var('page');
            if ($page < 2) {
                echo do_shortcode('[td_ad_box spot_id="header"]');
            }?>

And use this css: http://screencast.com/t/p6b7wtv6VrC

 .td-post-content .td-a-rec.td-a-rec-id-header{
top: auto;
left: auto;
margin-bottom: 30px;
} 

Thanks!

Post count: 28

Thanks once again Alin, straight to the point !

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.