Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114 Conditional Widget based on Venue | Event Espresso - Staging Server
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.