WordPress.org

Ready to get started?Download WordPress

Forums

Display posts based on Custom Field Date entry (3 posts)

  1. noworyz
    Member
    Posted 2 years ago #

    I am trying to create a loop where I display posts based on a date entry in a custom field. I want to display all posts that occur after today's date (as defined in the custom field). I have the following code in place but it doesn't seem to be working.

    http://pastebin.com/6szwDYnD

    I have made sure that the date format in the custom field is the same as I have the current date as stated in the code.

    The problem is, it is displaying EVERY post in my category instead of only the ones that occur in the future (based on custom field).

    This site is on a private server and is not accessible from outside our network.

  2. noworyz
    Member
    Posted 2 years ago #

    Ok, I think I figured out my issue...

    My Calendar picker for the custom field puts the date in the format mm/dd/yyyy and when comparing todays date in that format, it uses the month first to determine > or not.

    Is there a way to change the format of what is read in the DB to yyyy/mm/dd for comparison sakes?

    Does that make sense?

  3. ronr1999
    Member
    Posted 2 years ago #

    Any luck with this? I need to change our Archive widget to show archives based upon a custom date field. Looks like a similar project that you have here. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags