Home › Forums › Backend Issues (wp-admin) › Create dates on acf repeater rows possible ? › Reply To: Create dates on acf repeater rows possible ?
I’ve answered this myself. I’ve used the hidden field addon plugin (https://github.com/erickertz/acf-hidden). If you set it to a width of 0.1% and don’t give it a title it appears very subtle within a repeater element and isn’t an eyesore.
I’ve then used the append JS ACF hook to capture new repeater rows being added and I then populate this field with a unix datetime stamp!
// catch newly created repeater rows...
acf.add_action('append', function( $el ){
var unixdatetime = Math.round((new Date()).getTime() / 1000);
var $row = $el.closest('.acf-row');
$row.find('.acf-field-5ad749e45b14f input').val(unixdatetime);
console.log("set date time stamp: "+unixdatetime);
});
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
📣 “ACF Chat Fridays”
— Advanced Custom Fields (@wp_acf) January 31, 2023
The ACF team holds their first open office hours this Friday! Come and talk ACF, and ask questions about building sites with the plugin.
We’d love to see you there!
📆 Friday 3rd Feb - 3pm UTC
👉 Register here - https://t.co/3UtvQbE4CU pic.twitter.com/oTwW9K1XQ0
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.