Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Hunter Hawley
Hunter Hawley
3,948 Points

Working with dates, and triggers!

Hi,

I am trying to make an area on my Wordpress site that checks the date field on each of my custom post type posts each time I get on for any dates that are 7 days or less until the current date and then displays the corresponding post title. If you have questions about any of that, please just ask, it is hard to really explain it.

I would like to put an if statement in there that just says if any of the dates are 7 days or closer to the current date, display the title of that post.

Problems:

  1. The whole the_field( 'contract_sign_date' ); function displays the date as mm/dd/yy, so I'm not sure if subtracting the_field( 'contract_sign_date' ) by the current date will even come out right.

  2. If problem 1 would for some reason work, what if the contract sign date is the first of the month? 1 - 7 will = -6 instead of the current date.

Like I said, if you have questions about any of that, please just ask, it is hard to really explain it.