Support » Plugin: Custom Content Shortcode » IF with custom date field (pods)

  • We’ve spent many hours trying to figure this out and have determined that the date compare is just not working – at least in this implementation. It is also not failing in a consistent way to make it easy to figure out what it is doing. We have table of records (pods custom post types) that includes the field date_updated. That field is output properly, but when applying a comparison to it, it is not behaving normally. Here is the shortcode:
    loop starts
    [field date_updated] [if field=date_updated date_format=m/d/Y after='2 weeks ago'] NEW! [/if]
    loop ends

    And the results:

    Loop Output.....Actual Data
    01/03/19........2019-01-03
    01/15/19........2019-01-15
    05/09/19........2019-05-09
    04/09/19........2019-04-09
    06/01/19 NEW!...2019-04-16
    04/16/19........2019-03-21
    03/21/19........2019-03-14
    03/14/19........2019-01-10
    01/10/19........2019-05-11
    05/11/19........2019-02-01
    02/01/19........2019-02-06
    02/06/19........2019-05-10
    05/10/19........2019-05-29
    05/29/19 NEW!...2019-06-01
    03/15/19........2019-03-15
    02/18/19........2019-02-18
    04/16/19........2019-04-16
    03/15/19........2019-03-15
    04/11/19........2019-04-11
    04/08/19........2019-04-08
    01/03/19........2019-01-03
    03/26/19........2019-03-26
    11/16/18 NEW!...2018-11-16
    02/11/19........2019-02-11
    05/13/19........2019-05-13
    04/05/16........2016-04-05
    10/13/17 NEW!...2017-10-13
    04/28/18........2018-04-28
    02/03/17........2017-02-03
    05/31/18 NEW!...2018-05-31
    02/28/17........2017-02-28
    02/28/18........2018-02-28
    02/09/18........2018-02-09
    09/24/18 NEW!...2018-09-24
    08/15/18 NEW!...2018-08-15
    05/02/19........2019-05-02
    05/30/18 NEW!...2018-05-30
    01/25/13........2013-01-25
    03/25/15........2015-03-25
    12/18/18 NEW!...2018-12-18
    10/23/14 NEW!...2014-10-23
    11/30/15 NEW!...2015-11-30
    12/02/16 NEW!...2016-12-02
    02/05/19........2019-02-05
    02/18/19........2019-02-18
    02/13/19........2019-02-13
    12/08/18 NEW!...2018-12-08

    We tried format_date=’Ymd’ along with everything else we could think of and the results do change, but in no discernible relation to the data. I’ve looked at all the posts related to ACF date fields and they were no help. This should be a simple thing and it should work.

  • The topic ‘IF with custom date field (pods)’ is closed to new replies.