Collapse Advanced Custom Fields Repeater by default

How to make ACF repeater fields more readable? This function will collapse repeater fields by default:

/**
* Collapse ACF Repeater by default
*/
add_action('acf/input/admin_head', 'wpster_acf_repeater_collapse');
function wpster_acf_repeater_collapse() {
?>
<style id="wpster-acf-repeater-collapse">.acf-repeater .acf-table {display:none;}</style>
<script type="text/javascript">
	jQuery(function($) {
		$('.acf-repeater .acf-row').addClass('-collapsed');
		$('#wpster-acf-repeater-collapse').detach();
	});
</script>
<?php
}

2 Comments

  1. Great code ! Working like a charm !
    One more question : how authorize only One Tab Open ?

    Thanks a lot

    Reply
  2. Great stuff, got sick of scrolling all the time!

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *