Home Forums Event Espresso Premium Do not print out in the tag.php if the end date is past today's date.

Do not print out in the tag.php if the end date is past today's date.

Posted: August 4, 2015 at 8:16 am

Amanda Iaria

August 4, 2015 at 8:16 am

I apologize if the answer is some on here. I did search but nothing seemed to hit what I was looking for. Within our tag.php we want to make sure that if any of the event end dates is past the current date they wont show with in blog roll.

I’ve done a few different ways of doing this (and this is what I have at the moment), so I’m pretty certain I am not using the correct function … OR I’m just over thinking this, which is a huge possibility.

	while ( have_posts() ) : the_post();

				$edate = espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = FALSE);

				$dt = new DateTime("now");
				$enddate = new DateTime($edate);
				//$d = $dt->format("M d, Y");
				//$e =  $enddate->format("M d, Y");
				//$in = $dt->diff($enddate);
				//echo "IN:  ". $in;
				if($dt->format("u") > $enddate->format("u")):
					get_template_part( 'content', get_post_format() );

			// End the loop.

Whenever I echo the end date function I do get the end date, which is good. So I would think that it this would work. Then I thought, well maybe it’s just turning it into a string. I then just place the output in the DateTime object again. So I’m just stuck.


August 5, 2015 at 7:49 am


In the loop, use something like this:

if( !$post->EE_Event->is_upcoming() ) {

What that does is that the $post object, and use the EE_EVENT object in it and the is_upcoming method.

If the return is false it skips that event.

Amanda Iaria

August 5, 2015 at 12:44 pm



August 6, 2015 at 3:55 am

You’re welcome!

The support post ‘Do not print out in the tag.php if the end date is past today's date.’ 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: closed

Updated by  Dean 5 years ago ago

Topic Tags

Tagged: , , , ,


This topic is: not resolved
Do NOT follow this link or you will be banned from the site!