Order venues by number of events

Home Forums Calendar Products Events Calendar PRO Order venues by number of events

Viewing 10 posts - 16 through 25 (of 25 total)
  • Author
    Posts
  • #44121
    Jonah
    Participant

    Hi Joan,

    I’ve got a solution for you that requires two parts. One, a custom venue query like you’ve supplied running somewhere. Then if you put the following gist in your theme’s functions.php file, it should re-order the Venue’s by number of events for you: https://gist.github.com/PaulHughes01/5083640

    Let me know whether or not that works for you!

    – Jonah

    #44190
    Joan
    Participant

    I’m so sorry but if I put these gist in my theme function it returns all the venues with 55 events. May be I need to rewrite my venue query.

    #44212
    Jonah
    Participant

    Hi Joan,

    Yeah I didn’t have luck getting your custom function that displays the number of events to work properly but the gist itself should properly re-order venues based upon # of events. I tested this locally and it works for me. If you get the other custom function working, please let us know.

    Thanks,
    Jonah

    #44598
    Joan
    Participant

    Thank you Joanh,

    I ve done some modification on my funtion to get the number of events and it works!!!

    #44604
    Jonah
    Participant

    Hi Joan,

    That’s great to hear! Would you mind sharing your code updates? I’m thinking about writing a short tutorial on this and would like to include your code.

    Thanks,
    Jonah

    #44609
    Joan
    Participant

    Yes of course,

    function aolot_getVenueNextEvents($venue_ID)
    {
    global $post;
    global $wp_filter;
    $expos = new WP_Query();
    $expos->query( array(
    ‘post_type’=> ‘tribe_events’,
    ‘eventDisplay’ => ‘upcoming’,
    ‘posts_per_page’ => -1,
    ‘meta_query’ => array(array(
    ‘key’ => ‘_EventVenueID’,
    ‘value’ => $venue_ID))
    ));

    return $expos->posts;
    }

    #44619
    Jonah
    Participant

    Hmmm, this is not completely doing it for me. Did any other code need to be changed?

    #44623
    Joan
    Participant

    Sorry

    query( array(
    ‘post_type’=> ‘tribe_venue’,
    ‘posts_per_page’ => 24,
    ‘paged’ => $paged));
    if ($upcoming->have_posts()) :
    while ($upcoming->have_posts()) :
    $upcoming->the_post();
    ?>

    <a href="”>

    <a href="” rel=”bookmark”>

    <a href="” rel=”bookmark”>Properes activitats

    num_events;?>


    $upcoming ) ); // tell it which query we are paginating
    endif;
    wp_reset_query(); // important to reset the query
    ?>

    #44624
    Joan
    Participant

    Hope it works

    #44683
    Jonah
    Participant

    Hi Joan,

    Can you please post the code to http://snippi.com/

    Thanks,
    Jonah

Viewing 10 posts - 16 through 25 (of 25 total)
  • The topic ‘Order venues by number of events’ is closed to new replies.