[Support request] Format a meta field as a date (unix to date)

Home Forums Support [Support request] Format a meta field as a date (unix to date)

Home Forums Support Format a meta field as a date (unix to date)

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2350814
    mechamyu

    Hi, Sorry English isn’t my first language so I may express myself weird. I don’t have any issues reading though.

    Also sorry if this was addressed. I tried to google and search my way around but couldn’t figure anything to help me.

    So, I’ve been using a Query Loop generate press block and it works great, but, if I fetch meta data from a post that’s a custom post type, there doesn’t seem to be a way for me to format the results on the front end. I thought maybe it would be easy to say it’s a date, to start, so it wouldn’t show a unix value (as it is expected to store dates in databases), but I can’t find any guides to help.

    This is only the top of the iceberg of issues with data formating with Query Loops, however, as there are also serialized information I’d have loved to show up in some of my loops, but I wouldn’t be able as it would show up as a string of nonsense for everyone else to see.

    I was thinking, maybe I could tell Generate blocks to pass the information in a custom filter that would format the contents of the post meta values. Like, in the side box in gutenberg, I could type in a filter action name for that specific value, or something like that.

    Let me know if there’s a pure PHP thing I can do, as well. I’m used to do all of my query loops by hand ahah. I really appreciate the block because I don’t have to style everything once I made the loop. However, I can manage creating a few filters and throwing them in the right places if I have some documentation to guide me around the available actions in query loop blocks. I would rather not have to do everything back by hand just because I need some information formatted a little better, so any help is appreciated.

    I took a picture of what it looks like in case it helps.
    Showing the results of a query loop with a unix value for a date

    Thanks!

    #2350920
    Ying
    Staff
    Customer Support

    Hi there,

    GB’s dynamic option only pulls the pure data out of the custom field, in your case, GB shows the original data of the date, but it can not process the data to make it readable for humans.

    I would suggest creating a shortcode for those data with the functions that make them readable, then adding a shortcode block in the query loop.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.