Support » Plugin: Dynamic Conditions » How to only show posts with Custom date value > today?

  • Resolved hansvm

    (@hansvm)


    Using a post loop I display a number of custom posts.
    These posts contain a ACF custom date field called Datum.
    I would like to only display posts in the loop which have a Datum value that lies in the future.

    In the WordPress Dynamic Conditions plugin description page under FAQ > Can I set date based conditions, it is suggested, that it is possible to compare a custom post date field value against the current-date.

    So under Edit Posts > Advanced > Dynamic Conditions I have set Dynamic tag to this ACF field Datum, that is the custom post field that holds the date value I want to compare against the current-date.
    I further set Condition to Greater than and Compare type to Date.

    Regretfully the Conditional value can only be entered as a specific date picked from the calendar, NOT current-date.

    Has anybody got a suggestion?

    See the page link under Eerstvolgende dagritten.

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author crazypsycho

    (@crazypsycho)

    Hello @hansvm

    you can use String-To-Time instead of Date as Condition-Type.
    Than you can enter
    “now”

    https://www.php.net/manual/en/function.strtotime.php

    Thread Starter hansvm

    (@hansvm)

    Thanks for your reply!
    Regretfully so far I have not been able to get it working.
    The first post in the loop “Rondje Achterhoek” should be hidden, but it isn’t.

    My settings are:
    + Dynamic Tag > ACF Field (Datum)
    + Show/Hide > Hide when condition
    + Condition > Less than
    + Compare Type > String to time
    + Conditional value > “now”

    Hope you have more suggestions.

    Regards,
    Hans

    Plugin Author crazypsycho

    (@crazypsycho)

    Did you enter
    “now”
    or
    now
    ?

    Can you enable debug mode and copy/paste the result of debug info here?
    Than we can have a closer look.

    Thread Starter hansvm

    (@hansvm)

    Element:posts-5f51ecf (widget)
    DynamicTag-Tag:acf-text
    DynamicTag-Key:field_5f31417cdd97b:datum
    DynamicTag-Value:0
    DynamicTag-Value-Raw:
    Check-Value:0
    Check-Value2:0
    Condition-Type:strtotime
    Condition:Hide if less
    Condition met:no

    Plugin Author crazypsycho

    (@crazypsycho)

    It looks like the ACF field is empty.
    Can you create a text widget under the widget with the condition and select the ACF field as the content?
    Then the date should appear there. If not, the error would probably be in a completely different place.

    And be sure to write the “now” in the field without the quotation marks.

    Thread Starter hansvm

    (@hansvm)

    I solved the problem!

    I had put the condition on the Posts widget within the page that showed the posts.
    It suddenly occurred to me that I probably should have put the condition on the Post Loop template.

    I changed that and now it works perfectly.

    Thanks very much for your support.

    Regards,
    Hans

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to only show posts with Custom date value > today?’ is closed to new replies.