• Resolved Ynasr

    (@ynasr)


    Hi,

    I built the following loop. I am able to pull the title and permalink just fine. I am also trying to loop through the Latitude and Longitude. Could you please let me know what tag i should be using.

    `<?php $loop = new WP_Query( array( ‘post_type’ => ‘event’, ‘posts_per_page’ => -1 ) ); ?>
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>

    <h1><?php the_title() ?></h1>
    <h1><?php the_permalink() ?></h1>
    <h1><?php LATITUDE ?></h1>
    <h1><?php LONGITUDE ?></h1>
    <?php endwhile; wp_reset_query(); ?>’

    Many thanks,
    Yvan

    https://www.ads-software.com/plugins/events-manager/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    can I know where is this?(eg. single events template) I’m afraid that this will not work because Latitude and Longitude is from the location object.

    Thread Starter Ynasr

    (@ynasr)

    This is in a new template file I created. Is there a way to call lat and long, by binding tables, etc.

    Many thanks,
    yvan

    Plugin Support angelo_nwl

    (@angelo_nwl)

    if you can get the post id then you can try something like

    global $post;
    $EM_Event = em_get_event($post->ID, 'post_id');
    
    echo $EM_Event->get_location()->location_latitude;
    echo $EM_Event->get_location()->location_longitude;
    Thread Starter Ynasr

    (@ynasr)

    Well I am trying to loop through all the events-location so i do not have the exact post ID. Could one alternative be to insert the location_latitude and location_longitude (from the wp_em_locations table) directly into the wp_em_events table.

    Many thanks,
    Yvan

    Thread Starter Ynasr

    (@ynasr)

    Your code is actually exactly what I was looking for.
    Thank you so much!

    Best,
    yvan

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Looping through Latitude and Longitude tags’ is closed to new replies.