Home › Forums › ACF PRO › Override back-end labels ? › Reply To: Override back-end labels ?
Hi @beee
You should be able to do it by using a little bit advanced Javascript. Here’s an example how to do it:
add_action('acf/input/admin_footer', 'my_acf_change_repeater_label');
function my_acf_change_repeater_label() {
?>
<script type="text/javascript">
(function($) {
$(document).ready(function(){
// Hook when a new row is added
acf.add_action('append', function( $el ){
// Set default day and get the current total rows
var currentDay = "Monday";
var currentRow = $el.closest(".acf-table").find(".acf-row").length - 1;
console.log(currentRow);
// Convert current row to day name
switch(currentRow) {
case 2:
currentDay = "Tuesday";
break;
case 3:
currentDay = "Wednesday";
break;
}
// Replace the label
$el.find(".acf-field-123456789abc label").text(currentDay);
});
});
})(jQuery);
</script>
<?php
}
Where ‘.acf-field-123456789abc’ is the class of the field you want to target.
I hope this helps 🙂
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.