• Resolved sanderpinkse

    (@sanderpinkse)


    I’m trying to insert a date field in Pods template, using conditionals:

    [if agenda_datum]
    	Datum: {@agenda_datum}
    [/if]

    The strange thing is that Pods will show “Datum: “, even if the field is empty.

    If I change the field type to Plain Text, everything is fine.

    Can anybody reproduce this?

    Cheers!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Jim True

    (@jimtrue)

    I can confirm this is still a bug:
    https://github.com/pods-framework/pods/issues/3829

    You can workaround this by sending the field to your own function and returning the ‘Datum’ only if it’s not empty in the meantime, using this style:

    {@agenda_datum,display_datum} where display_datum is your own PHP function.

    I’m going to route your post here over to the bug report and close this request.

    Jim, please can you show me an example php function for this purpose ? Thanks!

    Plugin Contributor Jim True

    (@jimtrue)

    @pierluigi-abramo it helps if you don’t add a question to already resolved questions, because we don’t see them here.

    An example, using the format {@date_field,return_date}. I would add the following function to either my functions.php in the theme or to my own plugin code.

    
    function return_date($input_date) {
        return date("F d, Y", strtotime($input_date));
    }
    
    • This reply was modified 7 years, 7 months ago by Jim True.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Date fields and conditionals’ is closed to new replies.