Show ads on all non-sticky (featured ads) pages
Hi,
Thought someone else might find this off use.
I run ads just below the navigation bar and above the featured ads slider on my sites, but I didn't want to run ads on featured ads since I charge for them, and the other ads are free. (Free ads have advertising, featured ads don't) So far I've only done this for the top ads, but the principle for the sidebar is similar, unless you're running the ad code via a widget which makes things a bit more complicated.
In header.php, at the bottom of the file, just below
I added
Code:
<?php
$topads = 'true';
if(is_single())
{
global $wp_query;
$thePostID = $wp_query->post->ID;
if(is_sticky($thePostID))
{ $topads = 'false'; }
}
if ($topads == 'true') {
?>
PUT YOUR HTML HERE
<?php } ?>
I'm sure there's a programmatically more elegant way to do it, but this works well enough for me.