本文整理汇总了PHP中acf_enqueue_scripts函数的典型用法代码示例。如果您正苦于以下问题:PHP acf_enqueue_scripts函数的具体用法?PHP acf_enqueue_scripts怎么用?PHP acf_enqueue_scripts使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了acf_enqueue_scripts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
function load()
{
// hide upgrade
remove_action('admin_notices', array($this, 'admin_notices'), 1);
// load acf scripts
acf_enqueue_scripts();
}
示例2: network_load
function network_load()
{
// hide notice on this page
remove_action('network_admin_notices', array($this, 'network_admin_notices'), 1);
// load acf scripts
acf_enqueue_scripts();
}
示例3: admin_enqueue_scripts
function admin_enqueue_scripts()
{
// validate page
if (!$this->validate_page()) {
return;
}
// load acf scripts
acf_enqueue_scripts();
}
示例4: admin_enqueue_scripts
function admin_enqueue_scripts()
{
// validate page
if (!$this->validate_page()) {
return;
}
// load acf scripts
acf_enqueue_scripts();
// actions
add_action('add_meta_boxes_comment', array($this, 'edit_comment'), 10, 1);
}
示例5: admin_enqueue_scripts
function admin_enqueue_scripts()
{
// validate page
if (!$this->validate_page()) {
return;
}
// load acf scripts
acf_enqueue_scripts();
// actions
add_action('acf/input/admin_footer', array($this, 'admin_footer'));
}
示例6: admin_enqueue_scripts
function admin_enqueue_scripts()
{
// validate screen
if (acf_is_screen('widgets') || acf_is_screen('customize')) {
// valid
} else {
return;
}
// load acf scripts
acf_enqueue_scripts();
// actions
add_action('acf/input/admin_footer', array($this, 'admin_footer'), 1);
}
示例7: admin_enqueue_scripts
function admin_enqueue_scripts()
{
// validate page
if (!$this->validate_page()) {
return;
}
// vars
$screen = get_current_screen();
$taxonomy = $screen->taxonomy;
// load acf scripts
acf_enqueue_scripts();
// render
add_action("{$taxonomy}_add_form_fields", array($this, 'add_term'), 10, 1);
add_action("{$taxonomy}_edit_form", array($this, 'edit_term'), 10, 2);
}
示例8: load
function load()
{
// disable filters to ensure ACF loads raw data from DB
acf_disable_filters();
// run import / export
if (acf_verify_nonce('import')) {
$this->import();
} elseif (acf_verify_nonce('export')) {
if (isset($_POST['generate'])) {
$this->generate();
} else {
$this->export();
}
}
// load acf scripts
acf_enqueue_scripts();
}
示例9: load
function load()
{
// all export pages should not load local fields
acf_disable_local();
// run import / export
if (acf_verify_nonce('import')) {
$this->import();
} elseif (acf_verify_nonce('export')) {
if (isset($_POST['generate'])) {
$this->generate();
} else {
$this->export();
}
}
// load acf scripts
acf_enqueue_scripts();
}
示例10: current_screen
function current_screen()
{
// validate screen
if (!acf_is_screen('acf-field-group')) {
return;
}
// disable filters to ensure ACF loads raw data from DB
acf_disable_filters();
// enqueue scripts
acf_enqueue_scripts();
// actions
add_action('acf/input/admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
add_action('acf/input/admin_head', array($this, 'admin_head'));
add_action('acf/input/form_data', array($this, 'form_data'));
add_action('acf/input/admin_footer', array($this, 'admin_footer'));
add_action('acf/input/admin_footer_js', array($this, 'admin_footer_js'));
// filters
add_filter('acf/input/admin_l10n', array($this, 'admin_l10n'));
}
示例11: current_screen
function current_screen()
{
// validate screen
if (!acf_is_screen('acf-field-group')) {
return;
}
// disable JSON to avoid conflicts between DB and JSON
acf_disable_local();
// enqueue scripts
acf_enqueue_scripts();
// actions
add_action('acf/input/admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
add_action('acf/input/admin_head', array($this, 'admin_head'));
add_action('acf/input/form_data', array($this, 'form_data'));
add_action('acf/input/admin_footer', array($this, 'admin_footer'));
add_action('acf/input/admin_footer_js', array($this, 'admin_footer_js'));
// filters
add_filter('acf/input/admin_l10n', array($this, 'admin_l10n'));
}
示例12: acf_form_head
function acf_form_head()
{
// verify nonce
if (acf_verify_nonce('acf_form')) {
// validate data
if (acf_validate_save_post(true)) {
// form
$form = acf_extract_var($_POST, '_acf_form');
$form = @json_decode(base64_decode($form), true);
// validate
if (empty($form)) {
return;
}
// allow for custom save
$form['post_id'] = apply_filters('acf/pre_save_post', $form['post_id'], $form);
// save
acf_save_post($form['post_id']);
// redirect
if (!empty($form['return'])) {
// update %placeholders%
$form['return'] = str_replace('%post_url%', get_permalink($form['post_id']), $form['return']);
// redirect
wp_redirect($form['return']);
exit;
}
}
// if
}
// if
// load acf scripts
acf_enqueue_scripts();
}
示例13: admin_load
function admin_load()
{
// globals
global $plugin_page;
// vars
$this->page = acf_get_options_page($plugin_page);
// verify and remove nonce
if (acf_verify_nonce('options')) {
// save data
if (acf_validate_save_post(true)) {
// get post_id (allow lang modification)
$post_id = acf_get_valid_post_id($this->page['post_id']);
// set autoload
acf_update_setting('autoload', $this->page['autoload']);
// save
acf_save_post($post_id);
// redirect
wp_redirect(add_query_arg(array('message' => '1')));
exit;
}
}
// load acf scripts
acf_enqueue_scripts();
// actions
add_action('acf/input/admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
add_action('acf/input/admin_head', array($this, 'admin_head'));
// add columns support
add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
}
示例14: acf_form_head
function acf_form_head()
{
// verify nonce
if (acf_verify_nonce('acf_form')) {
// validate data
if (acf_validate_save_post(true)) {
// form
$GLOBALS['acf_form'] = acf_extract_var($_POST, '_acf_form');
$GLOBALS['acf_form'] = @json_decode(base64_decode($GLOBALS['acf_form']), true);
// validate
if (empty($GLOBALS['acf_form'])) {
return;
}
// vars
$post_id = acf_maybe_get($GLOBALS['acf_form'], 'post_id', 0);
// allow for custom save
$post_id = apply_filters('acf/pre_save_post', $post_id, $GLOBALS['acf_form']);
// save
acf_save_post($post_id);
// vars
$return = acf_maybe_get($GLOBALS['acf_form'], 'return', '');
// redirect
if ($return) {
// update %placeholders%
$return = str_replace('%post_url%', get_permalink($post_id), $return);
// redirect
wp_redirect($return);
exit;
}
}
// if
}
// if
// load acf scripts
acf_enqueue_scripts();
}
示例15: render
public function render()
{
acf_enqueue_scripts();
do_action('acf/view', $this->args, $this);
$post_id = $this->post_id;
$args = $this->args;
// vars
$field_groups = array();
$fields = array();
// post_title
if ($args['post_title']) {
$fields[] = acf_get_valid_field(array('name' => '_post_title', 'label' => 'Title', 'type' => 'text', 'value' => $post_id ? get_post_field('post_title', $post_id) : '', 'required' => true));
}
// post_content
if ($args['post_content']) {
$fields[] = acf_get_valid_field(array('name' => '_post_content', 'label' => 'Content', 'type' => 'wysiwyg', 'value' => $post_id ? get_post_field('post_content', $post_id) : ''));
}
// specific fields
if ($args['fields']) {
foreach ($args['fields'] as $selector) {
// append field ($strict = false to allow for better compatibility with field names)
$fields[] = acf_maybe_get_field($selector, $post_id, false);
}
} elseif ($args['field_groups']) {
foreach ($args['field_groups'] as $selector) {
$field_groups[] = acf_get_field_group($selector);
}
} elseif ($args['post_id'] == 'new_post') {
$field_groups = acf_get_field_groups(array('post_type' => $args['new_post']['post_type']));
} else {
$field_groups = acf_get_field_groups(array('post_id' => $args['post_id']));
}
//load fields based on field groups
if (!empty($field_groups)) {
foreach ($field_groups as $field_group) {
$field_group_fields = acf_get_fields($field_group);
if (!empty($field_group_fields)) {
foreach (array_keys($field_group_fields) as $i) {
$fields[] = acf_extract_var($field_group_fields, $i);
}
}
}
}
?>
<div class="acf-fields acf-form-fields -<?php
echo $args['label_placement'];
?>
">
<?php
// html before fields
echo $args['html_before_fields'];
// render
acf_views_render_fields($post_id, $fields, $args['field_el'], $args['instruction_placement']);
// html after fields
echo $args['html_after_fields'];
?>
</div><!-- acf-form-fields -->
<?php
}