Support

Home Forums Event Espresso Premium Get List of Venues and their ID's

Get List of Venues and their ID's

Posted: August 21, 2013 at 4:59 pm

Viewing 3 reply threads


marketing

August 21, 2013 at 4:59 pm

Is there a quick function available that can get these for me? I want to use this:

<?php echo do_shortcode('[ESPRESSO_VENUE_EVENTS id=1]');?>

but have the id part be a dynamic variable that is passed via a select input element on the same page, then I can load up events based on the location (venue) of their choosing.

Either that, or is this something that you think we should be modifying in the event_list_display.php file.


Dean

August 22, 2013 at 12:46 am

Hi Deborah,

There is nothing in built, you would need to run a custom function (I used the Custom Files Addon to do this) to grab the data from the database.

Something like

function get_all_venue_ids() {

global $wpdb;

$table_name = $wpdb->prefix . "events_venue"; 
   
$thevenues = $wpdb->get_col("SELECT id FROM $table_name");

return $thevenues;   
   
}

and then call it in the appropriate template like so

<?php $venue_id_array = get_all_venue_ids(); ?>

Now you have the venue ID’s in an array to do with as you need.


marketing

August 28, 2013 at 3:03 pm

Dean, this worked out great, I am able to get whatever I need from the db with this. Super convenient.


Dean

August 28, 2013 at 11:19 pm

You’re more than welcome!

Viewing 3 reply threads

The support post ‘Get List of Venues and their ID's’ 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.

Event Espresso