WordPress.org

Ready to get started?Download WordPress

Forums

Custom Content Type Manager
Display upcoming date, with the Summarize Posts Widget (2 posts)

  1. Hountla
    Member
    Posted 1 year ago #

    Hello,
    First, thanks a lot for you plugin(s).
    I'm really impressed by your work!
    It gives a lot of possibilities to my WordPress site and answers almost all my needs.

    But I have one big problem which I can't resolve till now:
    I created custom content type "Events". With a custom Field "opening day" Date.
    And I need to display, in the sidebar, the "upcoming events" only.
    So I used the Summarize Post widget, and I tried to find out a way to filter by starting date = today, using the "opening day" custom field.

    I don't find any solution, with the tool and the forum.
    Is it possible to do it?
    If not, do you have any suggestion?

    Thanks in advance

    http://wordpress.org/extend/plugins/custom-content-type-manager/

  2. fireproofsocks
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for the kind words.

    Dates are tricky, especially when it comes down to database interactions. So the first thing you need to do is store your event dates in a format that sorts correctly. I strongly encourage you to use the MySQL format YYYY-MM-DD HH:MM:SS -- that way they can sort numerically. You can change the format in your templates so the end users see them in whatever format you want.

    Once you have dates entered in a format that can be sorted, the next task is to do a query that sorts them. I wrote the GetPostsQuery class to provide a flexible API to the WP database without the wonky caveats and constant event pollution (it drives me nuts when random plugins or themes(!!!) hook into my database queries and I end up getting results other than the ones I queried for). So take a look at the underlying thing here: https://code.google.com/p/wordpress-custom-content-type-manager/wiki/get_posts

    Specifically, you could set the date_column to be your custom field for your event, and then use the date_min to specify the minimum date.... however, this isn't a dynamic value, so perhaps a feature request is appropriate so that you can specify a dynamic value for the dates here.

    If you need a widget in the sidebar, use the Summarize Posts widget: https://code.google.com/p/wordpress-custom-content-type-manager/wiki/Widget

    You can define a query there -- the filters that are visible are controlled via a configuration file, so if you need to unlock other form fields in order to define your search, you may need to edit the appropriate config file.

    That's a lot of info, and I'm not 100% sure you can solve your problem here without some dynamic date calculation, but you could come up with something viable I think.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic