Support » Plugin: The Events Calendar » Query to include events in home page order of event start date, not by post date

  • Resolved Commandrea

    (@commandrea)


    Hello- I have scoured the support forums and internet for the solution to this, but I’m only finding variations…

    I am showing six events on my home page, but they’re in order of post date, not start date. Can someone please assist/direct me to a solution? I need this working before I can upgrade to pro :/

    Using:

    <?php $posts = get_posts('post_type=tribe_events&numberposts=6'); foreach ($posts as $post) : start_wp(); ?>

    https://wordpress.org/plugins/the-events-calendar/

Viewing 4 replies - 1 through 4 (of 4 total)
  • RESOLVED!! Check this page

    <?php $loop = new WP_Query( array( 'post_type' => 'tribe_events', 'posts_per_page' => 6, 'orderby' => 'date', 'order' => 'ASC', 'paged' ) ); ?>    
    
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <?php get_post_meta($post->ID, 'events', true); ?>

    Resolved- see above

    Plugin Author Barry

    (@barryhughes-1)

    Glad you got there and thanks for sharing 🙂

    zumandrew

    (@zumandrew)

    Which file did you add this piece of beautiful code to?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Query to include events in home page order of event start date, not by post date’ is closed to new replies.