Just looking for a way to query upcoming events
-
I know this has been covered, again and again and again, and I’ve read many threads including https://www.ads-software.com/support/topic/em-with-wp_query-and-orderby-date?replies=14 and https://www.ads-software.com/support/topic/em-with-wp_query-and-orderby-date?replies=15 and https://www.ads-software.com/support/topic/how-to-show-upcoming-events-in-theme-using-wp_query?replies=2 and https://www.ads-software.com/support/topic/custom-query-ignores-scopefuture?replies=10
What I have in my theme is a place where it displays the latest posts, very nicely. The code goes kind of like this:
<?php $args = array( 'post_type' => 'event', 'posts_per_page' => '20', 'orderby' => 'event_start_date', 'order' => 'DESC', 'event-categories' => 'special-events', ); $loop = new WP_Query( $args ); /* $loop = EM_Events::get( array('scope'=>'future', 'event-categories' => 'special-events'); */ $newSlideActive = '<div class="item active">'; $newSlide = '<div class="item">'; $newSlideClose = '<div class="clear"></div></div>'; $i_latest_posts= 0; while ( $loop->have_posts() ) : $loop->the_post(); $i_latest_posts++;
I didn’t write it, so I don’t know what’s important. It used to have the
$args = array()
part that just had post type (which I changed), posts per page, and order. I added orderby, but that doesn’t seem to do anything, and event-categories, which works just fine.I read in one of the other threads something about using meta keys, but I really don’t understand that. I’ve tried it and it either does nothing or it prevents the page from loading.
I also read somewhere about just using EM_Events, which seems a lot simpler, so I have the code I was using above in comments. Whenever I use that instead, it prevents the page from loading, so it’s clearly wrong. But I’m not good enough at coding to figure it out.
I include the rest of the code because I really don’t want to mess up the way my theme displays it all. I would really appreciate some assistance. I know this topic has been covered before, and I searched through it, but I can’t figure out how to get it to work.
Thank you.
- The topic ‘Just looking for a way to query upcoming events’ is closed to new replies.