I’d like to display a widget based on the venue I choose for an event. For example, if the venue is North Florida, I’d like to automatically display a text widget with hotel information for that venue.
I tried using the widget logic plugin, but I believe it only works with default WP conditional tags. Most of these conditional widget plugins can only target specific pages and not content within them. Does anyone know of any alternatives that will work?
Is there some way to control this via Meta? Could I put a hidden tag in the venue description to call a widget?
Any help or push in the right direction would be greatly appreciated!
Using the meta data is actually a very good way of doing this. Simply add a meta tag to the event with a value.
You would need to be able to use PHP in a text widget (there are code snippets/plugins that can enable this) and in a text widget add something like
<?php
$my_variable_name = $event_meta['my_meta_key']; //replace this with the actual meta key
if ($my_variable_name = "my meta value") { // replace with the actual meta value
//some code goes here
} else {
//an error message or you can remove this else statement or, even have a default response for when the event/page doesnt have that meta key
}
?>
You would probably be wise to expand on this and tie in the event id or something as I think this might be too broad to use as is, it would need testing.
<?php
if($venue_title = 'Florida') { //Florida equals the venue NAME
echo "yay";
} else {
echo "boo";
}
?>
Viewing 3 reply threads
The support post ‘Conditional Widget based on Venue’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.