Forum Replies Created
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
August 9, 2016 at 6:37 am in reply to: Need to be able to sort events by the date they are created. #1149383Andrew ShepherdParticipant
YES!!!! That was it! Thank you so much!
I ended up using the following from what you gave me above.
$events = get_posts( array( 'posts_per_page' => 8, 'post_type' => 'tribe_events', 'orderby' => 'date', 'order' => 'DESC', 'post_status' => 'publish' ) );
August 5, 2016 at 9:32 am in reply to: Need to be able to sort events by the date they are created. #1148211Andrew ShepherdParticipantNico,
Originally I created a custom post type called “shows” and did a WP_Query to get the 8 most recent shows posted using the following code. I also used the Advanced Custom Fields plugin to add fields like Door Time, Ticket Price, Restrictions, etc.
$just_announced_args = array( 'post_type' => 'shows', 'posts_per_page' => 8, 'orderby' => 'date', 'order' => 'DESC', 'status' => 'publish'); $justannouncedshows = new WP_Query( $just_announced_args ); while ( $justannouncedshows->have_posts() ) : $justannouncedshows->the_post(); endwhile;
This query and loop got me what I needed.
This is the query I’m using to get the events sorted by the start date which pulls in the info correctly.global $post; // Retrieve all upcoming events $events = tribe_get_events( array( 'posts_per_page' => -1, 'start_date' => date( 'Y-m-d' ) ) );
Here is my query for trying to pull in the 8 most recent shows added to the Events Calendar.
$events = tribe_get_events( array( 'posts_per_page' => 8, 'post_type' => 'tribe_events', 'orderby' => 'date', 'order' => 'DESC', 'status' => 'publish' ) );
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)