Use the bw_related shortcode to list related items based on a date field.
Posts, pages and custom post types already have date fields for the publication date. There are times when it’s possible to use the publication date for the date of an event. But when there is more than one date – e.g. a start and end date or when the event is in the future then we need to use date fields to store the information.
The bw_related shortcode enables you to list content relative to the stored date.
For these examples we use the
oik_todo post type ( from the oik-todo sample plugin ) and a number of TODO items that have been done and which are planned to be done.
Items in the past
For the items that are complete the start and end dates record the dates upon which the task was done.
[bw_related post_type=oik_todo meta_key=_oik_todo_start meta_compare="<" orderby=meta_value order=DESC numberposts=10 format="L _" fields="_oik_todo_start"]
For some of the future items the start and end dates are invented. We need to have some far enough in the future to enable the examples to continue to work. Some of these TODO tasks should not be too arduous.
[bw_related post_type=oik_todo meta_key=_oik_todo_start meta_compare=">=" orderby=meta_value]