How to test for any TextLinkAds first

If you run Text Link Ads with the WordPress plugin, you might run into a situation where you want to check to see if there are any ads before you output them on your site. The reason, maybe that you have some heading or decoration near them that depends on them showing up. Well, I made a little hack to do just that.


<?php
/*homepage only*/
if(is_front_page() && function_exists("tla_ads"))
{
//hack to see if we have any ads available
global $textlinkads_object;
if (count($textlinkads_object->ads) > 0)
{
//output whatever heading or decoration you want here
tla_ads();//show ads
}
}
?>

Tags: , ,

Leave a Comment

Comments are reviewed before publishing to prevent spam.