Forums

How would I work with dates as custom metadata? (5 posts)

  1. ultrus
    Member
    Posted 3 years ago #

    Hello,
    I'm creating a custom "upcoming events" category page with the goal of listing events in the order that the event takes place, not the date the post was posted. A secondary goal is to not show event posts that took place more than 7 days ago.

    Custom metadata looks like the place to start. I even saw mention of using expiration dates as an advanced usage idea at: http://codex.wordpress.org/Using_Custom_Fields .

    Any thoughts on how I should format the dates, and sort posts by the custom event date key? How would I hide posts on a category page that are older than 7 days after the current date?

    I may be able to work most of this out after I get some rest. Until then, I look forward to any feedback and hints you may have. Thank you much in advance for the assistance! :)

  2. MichaelH
    Volunteer
    Posted 3 years ago #

    Wouldn't it be easier to start with an event plugin?

    http://www.google.com/search?q=wordpress+plugin+events

  3. ultrus
    Member
    Posted 3 years ago #

    I'm not always a fan of the easy way. The calendar plugin is a good reference that I will look at, but it's overkill for the website I'm working on. Maybe I should post with the actual post date as the event date. That would make it easier to run wordpress queries on anyway. I would just hide or reformat the post date as the event date for the "upcoming events" category, and any single post in that category.

    What are your thoughts? Thanks for the feedback. :)

  4. @mercime
    Member
    Posted 3 years ago #

    I concur with MichaelH with the plugin route especially if you're posting an announcement today about an event which will happen in the future. Event on Post Date will not be logical. That's all folks :-)

  5. ultrus
    Member
    Posted 3 years ago #

    mercime, MichaelH,
    Good points. I'll look around some more and maybe even create a small plugin based on other stuff I'm seeing. This would be a great opportunity to dig into wordpress functionality more. I was thinking about converting then storing the event dates as keys in seconds. That way I could specify a range better in the query, and sort nicely. Now I just need to dig around for the plugin hooks I need and make a plugin.

Topic Closed

This topic has been closed to new replies.

About this Topic