WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
[resolved] Query to include events in home page order of event start date, not by post date (5 posts)

  1. Commandrea
    Member
    Posted 6 months ago #

    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/

  2. Commandrea
    Member
    Posted 6 months ago #

    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); ?>
  3. Commandrea
    Member
    Posted 6 months ago #

    Resolved- see above

  4. Barry
    Member
    Plugin Author

    Posted 6 months ago #

    Glad you got there and thanks for sharing :-)

  5. zumandrew
    Member
    Posted 5 months ago #

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

Reply

You must log in to post.

About this Plugin

About this Topic