Home › Forums › Feature Requests › Customize the "add to gallery" button label › Reply To: Customize the "add to gallery" button label
Just chiming in here that if you want to tie your code to a field name instead of the ID (which would change if you created the field again elsewhere), you could change the selector in the example above to something like this:
function my_acf_ungallery_button() {
?>
<!-- Re-label ACF gallery button -->
<script>
(function($) {
window.addEventListener('DOMContentLoaded', function(){
$('.acf-field-gallery[data-name="your_field_name_here"] a.acf-gallery-add').text('Add to folder');
});
})(jQuery);
</script>
<!-- / Re-label ACF gallery button -->
<?php
}
add_action('acf/input/admin_footer', 'my_acf_ungallery_button');
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.