• Resolved cberendes

    (@cberendes)


    Second update: please ignore this in favor of a more clear report and request I just posted.

    Update: I am an idiot, but still have a problem. The code worked because I, coincidentally, added the two upcoming memorials on the same day I added the short codes, and the date_query works on post date by default. So all memorials added before today were past events, and all memorials added after yesterday were upcoming. That answers both questions below.

    But I still don’t have a dynamic query working. Adding either of the below to the first query, in hopes of finding only upcoming memorials, gets zero results:
    date_query_column=”date-start” date_query_after=”2022-10-05″
    OR
    date_column=”date-start” date_query_after=”yesterday”

    How do I fix?

    End update
    ___________________

    We show memorials as event posttypes on the website, organized by date-start.

    I wanted to list upcoming memorials (today or later) listed ascending (from today forward) and then list recent memorials (before today) in descending order (from yesterday into the past).

    I strongly believe I got it working with the shortcodes below, about five days ago. However, checking the page today (since kluged), I saw that the first query yielded no events, when it should have yielded two, and the second query yielded all four. Changing “today” to 2022-10-06 and “yesterday” to 2022-10-05 did not make a difference.

    I have since “duct-taped” the page by adding “recent” and “upcoming” to the event taxonomy, and relying entirely on a taxonomy search, so the page looks right. But I’d prefer a more dynamic solution.

    Two puzzles:
    1. Why doesn’t the code below work?
    2. Why did it work a few days ago, and not today?

    [display-posts post_type=”event” taxonomy=”event-types” tax_term=”Memorial” date_query_after=”yesterday” meta_key=”date-start” orderby=”meta_value” order=”ASC” no_posts_message=”Upcoming memorial services will be listed here once scheduled.” title=”Upcoming services:” include_excerpt=”true”]

    [display-posts post_type=”event” taxonomy=”event-types” tax_term=”Memorial” date_query_before=”today” meta_key=”date-start” orderby=”meta_value” order=”DESC” title=”Recent services:” include_excerpt=”true”]`

    • This topic was modified 3 years, 8 months ago by cberendes.
    • This topic was modified 3 years, 8 months ago by cberendes.

    The page I need help with: [log in to see the link]

The topic ‘date_query_before, date_query_after on event date stop working’ is closed to new replies.