Display Modified date and time of custom field

I want to display the Modified date and time of a custom field within an options page.

Currently I have {{dc:post:modified_date post="11537" format="D jS M Y"}} at {{dc:post:modified_time post="11537" format="H:i"}} but it’s not displaying the correct date and time that it was updated.

Options page is called Status
Field Group Name: Status fields
Fields in group: Status (text area) field_663b90bd259c4

It’s amazing what you can do when you READ documentation isn’t it… I think I have it sorted but would be helpful if you can confirm? Seems to be working… let me know if there’s a better way - https://snowwatch.org/status/

{{dc:looper:field key="created_date" type="date" format="D jS M Y"}} at {{dc:looper:field key="created_time" type="time" format="H:i"}}

Update: Sadly, it seems like it now updates everytime I save the /status page. I really just want to target the field only or it’s option page.

Hey Daniel,

The modified_date is a post/page meta. If you use it in the Options page, it will only display the modified date of the current page/post that you are editing. If you are trying to get the modified time of a particular post or custom post type, you need to run a looper first to display the item then you can display the modified date of that item.

Hope that makes sense.

Sooo, how would that look exactly?

{{dc:looper:field acf:option_field field="status" key="modified_date" type="date" format="D jS M Y"}} at {{dc:looper:field key="modified_time" type="time" format="H:i"}}

I have an options page with custom field text box inside so it can be updated by users then within a cornerstone component I have the section displayed (this is so I can display it in different places, I’m assuming this won’t effect things? If so I can have it display right in the page.)

Hi Daniel,

If you are using a Looper, you can add the following code inside the Looper to get the modified date of the specific post.

{{dc:post:modified_date}}

Hope it helps.
Thanks

But I’ve explained already that it’s a custom field?

Hey Daniel,

I want to display the Modified date and time of a custom field within an options page.
How the options page related to the page or post that you want to display the modified date? It is best that establish the relationship. At the moment, I do not get the whole picture. I would love to check your Option pages and how it is being set up. You may send us your WP details if you wouldn’t mind.

Thanks.

The options page simply has the text element inside it so anyone with access can update it. See secure note for login details.

Options page: https://snowwatch.org/wp-admin/post.php?post=11536&action=edit
Status Fields: https://snowwatch.org/wp-admin/post.php?post=11537&action=edit
Status Component: https://snowwatch.org/interface/edit/1802
Status Page: https://snowwatch.org/interface/edit/1476

Hey Daniel,

The modified date of the custom field will not be recorded since this is an options page. I would recommend that you add another field for the modified time and date in your Status field group. You can make the default time and date as the current time and date.

Points to remember, only the page, post and any other custom post types will have the modified_date meta. The option page do not have any meta.

Hope this helps.

Hello,

It doesn’t help me very much to be honest. I’m not entirely sure you understand what I need so I have done a video to double check, please watch here: https://share.zight.com/jkuj1JWz

How would I do that? AND make it so it cannot be changed by user?

Hello Daniel,

Please understand that the Status is an Options page. There is no available modified meta field on this because this is NOT a normal page or a post. It is an Options page which has is different. Therefore, when you want to edit the text, supply an additional field that will allow you to define the date and time of the edit.

You can then use this dynamic content to display the Status Text and the Updated Date:

<p>{{ acf.option_field({"field":"status"}) }}</p>
<p><strong>Updated: </strong>{{ acf.option_field({"field":"updated"}) }}</p>  

Hope this makes sense.

Hello @ruenel I understand you now however when updating it this evening the timestamp does not update correctly and is a few minute behind from when I updated it. It says 18:51 but it was really 18:56

Hey Daniel,

Upon checking, the Updated field and the DC output is synced or are the same.

image

image

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.