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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.