WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
[resolved] How do I use the value that the Dat (6 posts)

  1. GreyhoundXX
    Member
    Posted 2 years ago #

    I set a custom field as a Date and it asks me to input it like "May 20, 2012", but then it generates this value: 1337410800

    What do I do with that? I want to compare it to today's date, but have no clue how.

    Also, the date picker popup doesn't work. I click the calendar icon and nothing happens.

    http://wordpress.org/extend/plugins/types/

  2. AmirHelzer
    Member
    Plugin Author

    Posted 2 years ago #

    That decimal is the date, the way it's saved in the custom field. If you display the custom field's content, you're supposed to see that.

    If you use Types API, without the RAW argument, you should see the date.

    We've seen some cases when the datepicker isn't working. It's usually due to JS issues with the theme. Are you seeing JS errors in the JS console?

  3. GreyhoundXX
    Member
    Posted 2 years ago #

    How do I convert the decimal to a date? I tried looking up PHP Date to see if that was related, but it didn't seem right.

    I get this error:

    Resource interpreted as Script but transferred with MIME type text/html: "http://www.sitename.com/wp-content/plugins/lepopup-wp/files/editor_plugin.js.php?ver=345-20111127".

    On the right it says wp-tinymce.php. I'm in Chrome.

    Thanks for the help.

  4. AmirHelzer
    Member
    Plugin Author

    Posted 2 years ago #

    Types output functions should display that decimal as dates. Have a look here:
    http://wp-types.com/documentation/functions/

  5. GreyhoundXX
    Member
    Posted 2 years ago #

    Thanks, I have an expiration field called "date" and I checked it vs today's date to show a post or not.

    if((types_render_field("date", array("format" => "Ynd"))) >= date("Ynd")){ do stuff }

  6. AmirHelzer
    Member
    Plugin Author

    Posted 2 years ago #

    Great. Let's mark this as 'resolved'.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags