function acf_get_field_count($field_group) { // vars $count = 0; // local if (!$field_group['ID']) { $count = acf_count_local_fields($field_group['key']); // DB } else { // load fields $posts = get_posts(array('posts_per_page' => -1, 'post_type' => 'acf-field', 'orderby' => 'menu_order', 'order' => 'ASC', 'suppress_filters' => true, 'post_parent' => $field_group['ID'], 'fields' => 'ids', 'post_status' => 'publish, trash')); $count = count($posts); } // filter for 3rd party customization $count = apply_filters('acf/get_field_count', $count, $field_group); // return return $count; }
function sync_admin_footer() { // vars $i = -1; ?> <script type="text/html" id="tmpl-acf-json-tbody"> <?php foreach ($this->sync as $group) { $i++; ?> <tr <?php if ($i % 2 == 0) { ?> class="alternate"<?php } ?> > <th class="check-column" scope="row"> <label for="cb-select-<?php echo $group['key']; ?> " class="screen-reader-text"><?php printf(__('Select %s'), $group['title']); ?> </label> <input type="checkbox" value="<?php echo $group['key']; ?> " name="post[]" id="cb-select-<?php echo $group['key']; ?> "> </th> <td class="post-title page-title column-title"> <strong><?php echo $group['title']; ?> </strong> <div class="row-actions"> <span class="import"><a title="<?php echo esc_attr(__('Synchronise field group', 'acf')); ?> " href="<?php echo admin_url($this->url . '&post_status=sync&acfsync=' . $group['key'] . '&_wpnonce=' . wp_create_nonce('bulk-posts')); ?> "><?php _e('Sync', 'acf'); ?> </a></span> </div> </td> <td class="fields column-fields"><?php echo acf_count_local_fields($group['key']); ?> </td> </tr> <?php } ?> </script> <script type="text/javascript"> (function($){ // update table HTML $('#the-list').html( $('#tmpl-acf-json-tbody').html() ); // modify bulk actions $('#bulk-action-selector-bottom option[value="acfduplicate"]').attr('value','acfsync').text('<?php _e('Sync', 'acf'); ?> '); $('#bulk-action-selector-bottom option[value="trash"]').remove(); })(jQuery); </script> <?php }