Home › Forums › Front-end Issues › If repeater field in functions.php › Reply To: If repeater field in functions.php
I think I accidentally deleted my response, so here it is again:
I would use jQuery for this and also add the tab to the field group beforehand. You’ll want to use the acf/input/admin_footer action.
It would look something like this:
add_action('acf/input/admin_footer', 'check_for_videos');
function check_for_videos(){
?>
<script>
var rowCount = jQuery('#acf-group_571814caa0f78 table tbody).find('tr');
if(rowCount ==0 ){
jQuery('tab field selector here').hide();
}
</script>
<?
}
It is sometimes difficult to nail down the exact name to use in the selector. For me it’s a trial and error thing.
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.