• Using the below the array outputs repeats for the regions. How can I only display the region once? Using array_unique wont work as EM_Locations is a class? Do I have to modify EM_Locations completely to do this?

    <?php foreach(EM_Locations::get(array('orderby'=>'location_region')) as $EM_Region): ?>
    <a href="<?php echo home_url(); ?>/events/category/<?php echo strtolower($EM_Category->region); ?>" class="browse-reg browse-reg-grey">
    	<span><strong><?php echo $EM_Region->region; ?></strong></span><img src="<?php echo THEME_URL; ?>/images/box_arrow.png" alt="arrow" height="15" width="15">
    </a>
    <?php endforeach; ?>

    http://wordpress.org/extend/plugins/events-manager/

Viewing 1 replies (of 1 total)
  • Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    here is how the search form does it. whilst it’s not advised to directly query the db in EM in cases like this it’s faster:

    global $wpdb;
    $em_states = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT location_region FROM ".EM_LOCATIONS_TABLE." WHERE location_region IS NOT NULL AND location_region != '' AND location_country=%s", $country), ARRAY_N);
    foreach($em_states as $state){ ....
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Events Manager] Get Locations outputs repeats’ is closed to new replies.