function get_post_title($post, $field, $post_id = 0, $is_search = 0) { // get post_id if (!$post_id) { $post_id = acf_get_form_data('post_id'); } // vars $title = acf_get_post_title($post, $is_search); // filters $title = apply_filters('acf/fields/post_object/result', $title, $post, $field, $post_id); $title = apply_filters('acf/fields/post_object/result/name=' . $field['_name'], $title, $post, $field, $post_id); $title = apply_filters('acf/fields/post_object/result/key=' . $field['key'], $title, $post, $field, $post_id); // return return $title; }
function admin_footer() { // global global $wp_version; // options $o = array('post_id' => acf_get_form_data('post_id'), 'nonce' => wp_create_nonce('acf_nonce'), 'admin_url' => admin_url(), 'ajaxurl' => admin_url('admin-ajax.php'), 'ajax' => acf_get_form_data('ajax'), 'validation' => acf_get_form_data('validation'), 'wp_version' => $wp_version, 'acf_version' => acf_get_setting('version')); // l10n $l10n = apply_filters('acf/input/admin_l10n', array('unload' => __('The changes you made will be lost if you navigate away from this page', 'acf'), 'expand_details' => __('Expand Details', 'acf'), 'collapse_details' => __('Collapse Details', 'acf'), 'validation_successful' => __('Validation successful', 'acf'), 'validation_failed' => __('Validation failed', 'acf'), 'validation_failed_1' => __('1 field requires attention', 'acf'), 'validation_failed_2' => __('%d fields require attention', 'acf'), 'restricted' => __('Restricted', 'acf'))); ?> <script type="text/javascript"> acf = acf || {}; acf.o = <?php echo json_encode($o); ?> ; acf.l10n = <?php echo json_encode($l10n); ?> ; <?php do_action('acf/input/admin_footer_js'); ?> </script> <?php // action do_action('acf/input/admin_footer'); ?> <script type="text/javascript"> acf.do_action('prepare'); </script> <?php }
function get_result($user, $field, $post_id = 0) { // get post_id if (!$post_id) { $post_id = acf_get_form_data('post_id'); } // vars $result = $user->user_login; // append name if ($user->first_name) { $result .= ' (' . $user->first_name; if ($user->last_name) { $result .= ' ' . $user->last_name; } $result .= ')'; } // filters $result = apply_filters("acf/fields/user/result", $result, $user, $field, $post_id); $result = apply_filters("acf/fields/user/result/name={$field['_name']}", $result, $user, $field, $post_id); $result = apply_filters("acf/fields/user/result/key={$field['key']}", $result, $user, $field, $post_id); // return return $result; }
function get_term_title($term, $field, $post_id = 0) { // get post_id if (!$post_id) { $post_id = acf_get_form_data('post_id'); } // vars $title = ''; // ancestors $ancestors = get_ancestors($term->term_id, $field['taxonomy']); if (!empty($ancestors)) { $title .= str_repeat('- ', count($ancestors)); } // title $title .= $term->name; // filters $title = apply_filters('acf/fields/taxonomy/result', $title, $term, $field, $post_id); $title = apply_filters('acf/fields/taxonomy/result/name=' . $field['_name'], $title, $term, $field, $post_id); $title = apply_filters('acf/fields/taxonomy/result/key=' . $field['key'], $title, $term, $field, $post_id); // return return $title; }
function get_post_title($post, $field, $post_id = 0, $is_search = 0) { // get post_id if (!$post_id) { $post_id = acf_get_form_data('post_id'); } // vars $title = acf_get_post_title($post, $is_search); // featured_image if (acf_in_array('featured_image', $field['elements'])) { // vars $class = 'thumbnail'; $thumbnail = acf_get_post_thumbnail($post->ID, array(17, 17)); // icon if ($thumbnail['type'] == 'icon') { $class .= ' -' . $thumbnail['type']; } // append $title = '<div class="' . $class . '">' . $thumbnail['html'] . '</div>' . $title; } // filters $title = apply_filters('acf/fields/relationship/result', $title, $post, $field, $post_id); $title = apply_filters('acf/fields/relationship/result/name=' . $field['_name'], $title, $post, $field, $post_id); $title = apply_filters('acf/fields/relationship/result/key=' . $field['key'], $title, $post, $field, $post_id); // return return $title; }