Support

Home Forums Event Espresso Premium Creating Custom loop based on start dates?

Creating Custom loop based on start dates?

Posted: April 13, 2015 at 10:14 am

Viewing 4 reply threads


Kish Parmar

April 13, 2015 at 10:14 am

Hi there, we used EE 3 before and used this loop to create a custom loop.

<?php $args = array(
‘post_type’ => ‘espresso_event’,
‘posts_per_page’ => 50,
‘meta_key’ => ‘event_start_date’,
‘orderby’ => ‘meta_value’,
‘order’ => ‘ASC’,
‘meta_query’ => array(
array(
‘key’ => ‘event_start_date’,
‘compare’ => ‘>=’,
‘value’ => date(‘Y-m-d’),
‘type’ => ‘DATE’
),
array(
‘key’ => ‘event_end_date’,
‘compare’ => ‘<=’,
‘value’ => date(‘Y-m-d’,strtotime(“+60 days”)),
‘type’ => ‘DATE’
),

),
); ?>

<?php $loop = new WP_Query( $args ); ?>

now its not working as we updated to EE4, i guess meta keys changed ‘event_start_date’ ?


Kish Parmar

April 14, 2015 at 5:22 am

Solved. thanks


Dean

April 14, 2015 at 6:08 am

Hi,

I’m glad to hear you got it sorted already. Is there anything else we can help with regarding this topic or can it be marked as resolved?


Maurice Langlais

April 14, 2015 at 6:31 am

Kish, I was wondering if you could post your solution for this? Thanks


Kish Parmar

April 14, 2015 at 7:53 am

just used

archive-espresso_events.php` with default loop.

But it looks like

                        <?php $args = array( 
				'post_type' => 'espresso_events',
				'posts_per_page' => 50
                                /// more arguments here
			); ?>

			<?php $loop = new WP_Query( $args ); ?>

			<?php while($loop->have_posts()): $loop->the_post(); ?>
                            //your code here
                        <?php endwhile; ?>
Viewing 4 reply threads

The support post ‘Creating Custom loop based on start dates?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso