Limit to 1 widget
-
First off, great job – this is an ingenious plugin!
I have a few widgets set up with the following logic. I intend to use it as a simple solution for internal ads. I only want one maximum widget to display.
is_single() && in_category('Topic-A') && define('ad_displayed', true)
is_single() && in_category('Topic-B') && define('ad_displayed', true)
If a post is in both Category-A and Category-B, the first widget above should show, and the second shouldn’t.
I feel like I’ve tried every possible way to accomplish this. The method above seems to be the most foolproof. The last condition, PHP’s define returns true the first time it is set, and it returns false subsequent attempts. Strangely, with Widget Logic, the constant above gets defined, but the widget won’t show.
I’ve also tried the same kind of logic using variables, including superglobals.
I hope this makes sense. Please let me know if I can clarify anything. Any help is very appreciated!
- The topic ‘Limit to 1 widget’ is closed to new replies.