From 08b745e3ef9664c04255febd759f115cb1caaaf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beausoleil?= Date: Tue, 8 Jun 2010 08:05:39 -0400 Subject: [PATCH] Handle more single options: added home and front. --- adgear-ad-manager.php | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/adgear-ad-manager.php b/adgear-ad-manager.php index 950d39a..84eb4fb 100644 --- a/adgear-ad-manager.php +++ b/adgear-ad-manager.php @@ -149,6 +149,31 @@ function adgear_ad($atts) { "path_post" => "", ), $atts)); + switch($single) { + case 'yes': + if (!is_single()) return ""; + break; + + case 'no': + if (!is_single()) return ""; + break; + + case 'front': + if (!is_front_page()) return ""; + break; + + case 'home': + if (!is_home()) return ""; + break; + + case 'all': + /* NOP: we always succeed */ + break; + + case else: + return "

WARNING: AdGear Ad Manager did not understand the "single" option. This parameter accepts one of five values: yes, no, all, home or front; not $single.

"; + } + // If this tag should render only on single posts page, and we're not on a single post, abort if ($single == 'yes' && !is_single()) return ""; @@ -243,9 +268,11 @@ function adgear_single_selector_ui($args) { extract($args); ?>