当前位置: 首页>>代码示例>>PHP>>正文


PHP acf_get_path函数代码示例

本文整理汇总了PHP中acf_get_path函数的典型用法代码示例。如果您正苦于以下问题:PHP acf_get_path函数的具体用法?PHP acf_get_path怎么用?PHP acf_get_path使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了acf_get_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ajax_upgrade

 function ajax_upgrade()
 {
     // options
     $options = acf_parse_args($_POST, array('version' => '', 'nonce' => ''));
     // validate
     if (!wp_verify_nonce($options['nonce'], 'acf_nonce')) {
         wp_send_json_error();
     }
     // vars
     $path = acf_get_path("admin/updates/{$options['version']}.php");
     // load version
     if (!file_exists($path)) {
         wp_send_json_error();
     }
     // load any errors / feedback from update
     ob_start();
     // include
     include $path;
     // get feedback
     $feedback = ob_get_clean();
     // update successful
     update_option('acf_version', $options['version']);
     // check for relevant updates. If none are found, update this to the plugin version
     $updates = acf_get_updates();
     if (empty($updates)) {
         update_option('acf_version', acf_get_setting('version'));
     }
     // return
     wp_send_json_success(array('feedback' => $feedback));
 }
开发者ID:dleatherman,项目名称:timbangular-js,代码行数:30,代码来源:update.php

示例2: __construct

 function __construct()
 {
     /*
      *  name (string) Single word, no spaces. Underscores allowed
      */
     $this->name = 'button';
     /*
      *  label (string) Multiple words, can include spaces, visible when selecting a field type
      */
     $this->label = __('Button', 'acf-button');
     /*
      *  category (string) basic | content | choice | relational | jquery | layout | CUSTOM GROUP NAME
      */
     $this->category = 'basic';
     /*
      *  defaults (array) Array of default settings which are merged into the field object. These are used later in settings
      */
     $this->defaults = array();
     /*
      *  l10n (array) Array of strings that are used in JavaScript. This allows JS strings to be translated in PHP and loaded via:
      *  var message = acf._e('button', 'error');
      */
     $this->l10n = array('error' => __('Error! Please enter a value', 'acf-button'));
     // do not delete!
     parent::__construct();
     $this->settings = array('path' => acf_get_path(__DIR__), 'dir' => plugin_dir_url(__FILE__), 'version' => '1.0.0');
 }
开发者ID:SnakeO,项目名称:acf-admin-button-field,代码行数:27,代码来源:button-v5.php

示例3: acf_pro_get_view

function acf_pro_get_view($view_name = '', $args = array())
{
    // vars
    $path = acf_get_path("pro/admin/views/{$view_name}.php");
    if (file_exists($path)) {
        include $path;
    }
}
开发者ID:uwmadisoncals,项目名称:vmmm,代码行数:8,代码来源:api-pro.php

示例4: mb_locations

 function mb_locations()
 {
     // global
     global $post;
     // vars
     $field_group = acf_get_field_group($post);
     // UI needs at lease 1 location rule
     if (empty($field_group['location'])) {
         $field_group['location'] = array(array(array('param' => 'post_type', 'operator' => '==', 'value' => 'post')));
     }
     // don't use view because we need access to $this context
     include acf_get_path('admin/views/field-group-locations.php');
 }
开发者ID:eea76,项目名称:hammer,代码行数:13,代码来源:field-group.php

示例5: acf_get_updates

function acf_get_updates()
{
    // vars
    $updates = array();
    $plugin_version = acf_get_setting('version');
    $acf_version = get_option('acf_version');
    $path = acf_get_path('admin/updates');
    // check that path exists
    if (!file_exists($path)) {
        return false;
    }
    $dir = opendir($path);
    while (false !== ($file = readdir($dir))) {
        // only php files
        if (substr($file, -4) !== '.php') {
            continue;
        }
        // get version number
        $update_version = substr($file, 0, -4);
        // ignore if update is for a future version. May exist for testing
        if (version_compare($update_version, $plugin_version, '>')) {
            continue;
        }
        // ignore if update has already been run
        if (version_compare($update_version, $acf_version, '<=')) {
            continue;
        }
        // append
        $updates[] = $update_version;
    }
    // return
    return $updates;
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:33,代码来源:api-helpers.php

示例6: initialize

 function initialize()
 {
     // vars
     $this->settings = array('name' => __('Advanced Custom Fields', 'acf'), 'version' => '5.2.5', 'basename' => plugin_basename(__FILE__), 'path' => plugin_dir_path(__FILE__), 'dir' => plugin_dir_url(__FILE__), 'show_admin' => true, 'show_updates' => true, 'stripslashes' => false, 'local' => true, 'json' => true, 'save_json' => '', 'load_json' => array(), 'default_language' => '', 'current_language' => '', 'capability' => 'manage_options', 'uploader' => 'wp');
     // include helpers
     include_once 'api/api-helpers.php';
     // set text domain
     load_textdomain('acf', acf_get_path('lang/acf-' . get_locale() . '.mo'));
     // api
     acf_include('api/api-value.php');
     acf_include('api/api-field.php');
     acf_include('api/api-field-group.php');
     acf_include('api/api-template.php');
     // core
     acf_include('core/ajax.php');
     acf_include('core/field.php');
     acf_include('core/input.php');
     acf_include('core/json.php');
     acf_include('core/local.php');
     acf_include('core/location.php');
     acf_include('core/media.php');
     acf_include('core/revisions.php');
     acf_include('core/compatibility.php');
     acf_include('core/third_party.php');
     // forms
     acf_include('forms/attachment.php');
     acf_include('forms/comment.php');
     acf_include('forms/post.php');
     acf_include('forms/taxonomy.php');
     acf_include('forms/user.php');
     acf_include('forms/widget.php');
     // admin
     if (is_admin()) {
         acf_include('admin/admin.php');
         acf_include('admin/field-group.php');
         acf_include('admin/field-groups.php');
         acf_include('admin/update.php');
         acf_include('admin/settings-export.php');
         //acf_include('admin/settings-addons.php');
         acf_include('admin/settings-info.php');
     }
     // fields
     acf_include('fields/text.php');
     acf_include('fields/textarea.php');
     acf_include('fields/number.php');
     acf_include('fields/email.php');
     acf_include('fields/url.php');
     acf_include('fields/password.php');
     acf_include('fields/wysiwyg.php');
     acf_include('fields/oembed.php');
     acf_include('fields/image.php');
     acf_include('fields/file.php');
     acf_include('fields/select.php');
     acf_include('fields/checkbox.php');
     acf_include('fields/radio.php');
     acf_include('fields/true_false.php');
     acf_include('fields/post_object.php');
     acf_include('fields/page_link.php');
     acf_include('fields/relationship.php');
     acf_include('fields/taxonomy.php');
     acf_include('fields/user.php');
     acf_include('fields/google-map.php');
     acf_include('fields/date_picker.php');
     acf_include('fields/color_picker.php');
     acf_include('fields/message.php');
     acf_include('fields/tab.php');
     // pro
     acf_include('pro/acf-pro.php');
     // actions
     add_action('init', array($this, 'wp_init'), 5);
     add_filter('posts_where', array($this, 'wp_posts_where'), 10, 2);
     //add_filter('posts_orderby',	array($this, 'wp_posts_orderby'), 10, 2 );
     //add_filter('posts_groupby',	array($this, 'wp_posts_groupby'), 10, 2 );
     //add_filter('posts_request',	array($this, 'posts_request'), 10, 1 );
 }
开发者ID:bmavus,项目名称:wp-theme-blank,代码行数:75,代码来源:acf.php

示例7: enqueue_assets

 function enqueue_assets()
 {
     // globals
     global $wp_scripts, $wp_styles;
     // vars
     $version = '3.5.2';
     $lang = get_locale();
     $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     //$lang = 'fr';
     // v4
     /*
     		wp_enqueue_script('select2', acf_get_dir("assets/inc/select2/dist/js/select2.full.js"), array('jquery'), '4.0', true );
     		wp_enqueue_style('select2', acf_get_dir("assets/inc/select2/dist/css/select2{$min}.css"), '', '4.0' );
     		return;
     */
     // register script
     if (!isset($wp_scripts->registered['select2'])) {
         // scripts
         wp_register_script('select2', acf_get_dir("assets/inc/select2/select2{$min}.js"), array('jquery'), $version);
         // translation
         if ($lang) {
             // vars
             $lang = str_replace('_', '-', $lang);
             $lang_code = substr($lang, 0, 2);
             $lang_src = '';
             // attempt 1
             if (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang_code}.js"))) {
                 $lang_src = acf_get_dir("assets/inc/select2/select2_locale_{$lang_code}.js");
                 // attempt 2
             } elseif (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang}.js"))) {
                 $lang_src = acf_get_dir("assets/inc/select2/select2_locale_{$lang}.js");
             }
             // enqueue
             if ($lang_src) {
                 wp_enqueue_script('select2-l10n', $lang_src, array('select2'), $version);
             }
         }
         // end translation
     }
     // register style
     if (!isset($wp_styles->registered['select2'])) {
         wp_register_style('select2', acf_get_dir('assets/inc/select2/select2.css'), '', $version);
     }
     // enqueue
     wp_enqueue_script('select2');
     wp_enqueue_style('select2');
 }
开发者ID:SayenkoDesign,项目名称:bushcooking.com,代码行数:47,代码来源:select.php

示例8: wp_init

 function wp_init()
 {
     // vars
     $cap = acf_get_setting('capability');
     $version = acf_get_setting('version');
     $lang = get_locale();
     $scripts = array();
     $styles = array();
     $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     // Create post type 'acf-field-group'
     register_post_type('acf-field-group', array('labels' => array('name' => __('Field Groups', 'acf'), 'singular_name' => __('Field Group', 'acf'), 'add_new' => __('Add New', 'acf'), 'add_new_item' => __('Add New Field Group', 'acf'), 'edit_item' => __('Edit Field Group', 'acf'), 'new_item' => __('New Field Group', 'acf'), 'view_item' => __('View Field Group', 'acf'), 'search_items' => __('Search Field Groups', 'acf'), 'not_found' => __('No Field Groups found', 'acf'), 'not_found_in_trash' => __('No Field Groups found in Trash', 'acf')), 'public' => false, 'show_ui' => true, '_builtin' => false, 'capability_type' => 'post', 'capabilities' => array('edit_post' => $cap, 'delete_post' => $cap, 'edit_posts' => $cap, 'delete_posts' => $cap), 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_menu' => false));
     // Create post type 'acf-field'
     register_post_type('acf-field', array('labels' => array('name' => __('Fields', 'acf'), 'singular_name' => __('Field', 'acf'), 'add_new' => __('Add New', 'acf'), 'add_new_item' => __('Add New Field', 'acf'), 'edit_item' => __('Edit Field', 'acf'), 'new_item' => __('New Field', 'acf'), 'view_item' => __('View Field', 'acf'), 'search_items' => __('Search Fields', 'acf'), 'not_found' => __('No Fields found', 'acf'), 'not_found_in_trash' => __('No Fields found in Trash', 'acf')), 'public' => false, 'show_ui' => false, '_builtin' => false, 'capability_type' => 'post', 'capabilities' => array('edit_post' => $cap, 'delete_post' => $cap, 'edit_posts' => $cap, 'delete_posts' => $cap), 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_menu' => false));
     // append scripts
     $scripts['select2'] = array('src' => acf_get_dir("assets/inc/select2/select2{$min}.js"), 'deps' => array('jquery'));
     $scripts['acf-input'] = array('src' => acf_get_dir("assets/js/acf-input{$min}.js"), 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-resizable', 'jquery-ui-datepicker', 'wp-color-picker', 'select2'));
     $scripts['acf-field-group'] = array('src' => acf_get_dir("assets/js/acf-field-group{$min}.js"), 'deps' => array('acf-input'));
     // select2-l10n
     if ($lang) {
         // vars
         $lang = str_replace('_', '-', $lang);
         $lang_code = substr($lang, 0, 2);
         $src = '';
         // attempt 1
         if (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang_code}.js"))) {
             $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang_code}.js");
         } elseif (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang}.js"))) {
             $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang}.js");
         }
         // only append if file exists
         if ($src) {
             // append script
             $scripts['select2-l10n'] = array('src' => $src, 'deps' => array('select2'));
             // append dep
             $scripts['acf-input']['deps'][] = 'select2-l10n';
         }
     }
     // register scripts
     foreach ($scripts as $handle => $script) {
         wp_register_script($handle, $script['src'], $script['deps'], $version);
     }
     // append styles
     $styles['select2'] = array('src' => acf_get_dir('assets/inc/select2/select2.css'), 'deps' => false);
     $styles['acf-datepicker'] = array('src' => acf_get_dir('assets/inc/datepicker/jquery-ui-1.10.4.custom.min.css'), 'deps' => false);
     $styles['acf-global'] = array('src' => acf_get_dir('assets/css/acf-global.css'), 'deps' => false);
     $styles['acf-input'] = array('src' => acf_get_dir('assets/css/acf-input.css'), 'deps' => array('acf-global', 'wp-color-picker', 'select2', 'acf-datepicker'));
     $styles['acf-field-group'] = array('src' => acf_get_dir('assets/css/acf-field-group.css'), 'deps' => array('acf-input'));
     // register styles
     foreach ($styles as $handle => $style) {
         wp_register_style($handle, $style['src'], $style['deps'], $version);
     }
     // complete loading of ACF files
     $this->complete();
 }
开发者ID:jewbre,项目名称:vdlhr,代码行数:54,代码来源:acf.php

示例9: init

 function init()
 {
     // bail early if a plugin called get_field early
     if (!did_action('plugins_loaded')) {
         return;
     }
     // bail early if already init
     if (acf_get_setting('init')) {
         return;
     }
     // only run once
     acf_update_setting('init', true);
     // vars
     $major = intval(acf_get_setting('version'));
     // redeclare dir
     // - allow another plugin to modify dir (maybe force SSL)
     acf_update_setting('dir', plugin_dir_url(__FILE__));
     // set text domain
     load_textdomain('acf', acf_get_path('lang/acf-' . get_locale() . '.mo'));
     // include wpml support
     if (defined('ICL_SITEPRESS_VERSION')) {
         acf_include('core/wpml.php');
     }
     // field types
     acf_include('fields/text.php');
     acf_include('fields/textarea.php');
     acf_include('fields/number.php');
     acf_include('fields/email.php');
     acf_include('fields/url.php');
     acf_include('fields/password.php');
     acf_include('fields/wysiwyg.php');
     acf_include('fields/oembed.php');
     acf_include('fields/image.php');
     acf_include('fields/file.php');
     acf_include('fields/select.php');
     acf_include('fields/checkbox.php');
     acf_include('fields/radio.php');
     acf_include('fields/true_false.php');
     acf_include('fields/post_object.php');
     acf_include('fields/page_link.php');
     acf_include('fields/relationship.php');
     acf_include('fields/taxonomy.php');
     acf_include('fields/user.php');
     acf_include('fields/google-map.php');
     acf_include('fields/date_picker.php');
     acf_include('fields/date_time_picker.php');
     acf_include('fields/time_picker.php');
     acf_include('fields/color_picker.php');
     acf_include('fields/message.php');
     acf_include('fields/tab.php');
     // 3rd party field types
     do_action('acf/include_field_types', $major);
     // local fields
     do_action('acf/include_fields', $major);
     // action for 3rd party
     do_action('acf/init');
 }
开发者ID:fullsteamlabs,项目名称:root-around,代码行数:57,代码来源:acf.php

示例10: register_assets

 function register_assets()
 {
     // vars
     $version = acf_get_setting('version');
     $lang = get_locale();
     $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     $scripts = array();
     $styles = array();
     // append scripts
     $scripts['select2'] = array('src' => acf_get_dir("assets/inc/select2/select2{$min}.js"), 'deps' => array('jquery'));
     $scripts['acf-input'] = array('src' => acf_get_dir("assets/js/acf-input{$min}.js"), 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-resizable', 'jquery-ui-datepicker', 'wp-color-picker', 'select2'));
     $scripts['acf-field-group'] = array('src' => acf_get_dir("assets/js/acf-field-group{$min}.js"), 'deps' => array('acf-input'));
     // select2-l10n
     if ($lang) {
         // vars
         $lang = str_replace('_', '-', $lang);
         $lang_code = substr($lang, 0, 2);
         $src = '';
         // attempt 1
         if (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang_code}.js"))) {
             $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang_code}.js");
         } elseif (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang}.js"))) {
             $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang}.js");
         }
         // only append if file exists
         if ($src) {
             // append script
             $scripts['select2-l10n'] = array('src' => $src, 'deps' => array('select2'));
             // append dep
             $scripts['acf-input']['deps'][] = 'select2-l10n';
         }
     }
     // register scripts
     foreach ($scripts as $handle => $script) {
         wp_register_script($handle, $script['src'], $script['deps'], $version);
     }
     // append styles
     $styles['select2'] = array('src' => acf_get_dir('assets/inc/select2/select2.css'), 'deps' => false);
     $styles['acf-datepicker'] = array('src' => acf_get_dir('assets/inc/datepicker/jquery-ui-1.10.4.custom.min.css'), 'deps' => false);
     $styles['acf-global'] = array('src' => acf_get_dir('assets/css/acf-global.css'), 'deps' => false);
     $styles['acf-input'] = array('src' => acf_get_dir('assets/css/acf-input.css'), 'deps' => array('acf-global', 'wp-color-picker', 'select2', 'acf-datepicker'));
     $styles['acf-field-group'] = array('src' => acf_get_dir('assets/css/acf-field-group.css'), 'deps' => array('acf-input'));
     // register styles
     foreach ($styles as $handle => $style) {
         wp_register_style($handle, $style['src'], $style['deps'], $version);
     }
 }
开发者ID:erickolivares,项目名称:mindsauce,代码行数:47,代码来源:acf.php

示例11: ajax_upgrade

 function ajax_upgrade()
 {
     // options
     $options = wp_parse_args($_POST, array('nonce' => '', 'blog_id' => ''));
     // validate
     if (!wp_verify_nonce($options['nonce'], 'acf_upgrade')) {
         wp_send_json_error();
     }
     // switch blog
     if ($options['blog_id']) {
         switch_to_blog($options['blog_id']);
     }
     // vars
     $updates = acf_get_updates();
     $message = '';
     // bail early if no updates
     if (empty($updates)) {
         wp_send_json_error(array('message' => 'No updates available'));
     }
     // install updates
     foreach ($updates as $version) {
         // get path
         $path = acf_get_path("admin/updates/{$version}.php");
         // load version
         if (!file_exists($path)) {
             wp_send_json_error(array('message' => 'Error loading update'));
         }
         // load any errors / feedback from update
         ob_start();
         // action for 3rd party
         do_action('acf/upgrade_start/' . $version);
         // include
         include $path;
         // action for 3rd party
         do_action('acf/upgrade_finish/' . $version);
         // get feedback
         $message .= ob_get_clean();
         // update successful
         update_option('acf_version', $version);
     }
     // updates complete
     update_option('acf_version', acf_get_setting('version'));
     // return
     wp_send_json_success(array('message' => $message));
 }
开发者ID:slavic18,项目名称:cats,代码行数:45,代码来源:update.php

示例12: elseif

			</div>			
		</div>
		
	</div>
	
<?php 
} elseif ($active == 'changelog') {
    ?>
	
	<p class="about-description"><?php 
    printf(__("We think you'll love the changes in %s.", 'acf'), $version);
    ?>
</p>
	
	<?php 
    $items = file_get_contents(acf_get_path('readme.txt'));
    $items = explode('= ' . $version . ' =', $items);
    $items = end($items);
    $items = current(explode("\n\n", $items));
    $items = array_filter(array_map('trim', explode("*", $items)));
    ?>
	<ul class="changelog">
	<?php 
    foreach ($items as $item) {
        $item = explode('http', $item);
        ?>
		<li><?php 
        echo $item[0];
        if (isset($item[1])) {
            ?>
<a href="http<?php 
开发者ID:jewbre,项目名称:vdlhr,代码行数:31,代码来源:settings-info.php

示例13: enqueue_assets

 function enqueue_assets()
 {
     // vars
     $version = '3.5.2';
     $lang = get_locale();
     $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     // v4
     /*
     		wp_enqueue_script('select2', acf_get_dir("assets/inc/select2/dist/js/select2.full.js"), array('jquery'), '4.0', true );
     		wp_enqueue_style('select2', acf_get_dir("assets/inc/select2/dist/css/select2{$min}.css"), '', '4.0' );
     		return;
     */
     // scripts
     wp_enqueue_script('select2', acf_get_dir("assets/inc/select2/select2{$min}.js"), array('jquery'), $version, true);
     // styles
     wp_enqueue_style('select2', acf_get_dir('assets/inc/select2/select2.css'), '', $version);
     // bail early if no language
     if (!$lang) {
         return;
     }
     // vars
     $lang = str_replace('_', '-', $lang);
     $lang_code = substr($lang, 0, 2);
     $src = '';
     // attempt 1
     if (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang_code}.js"))) {
         $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang_code}.js");
     } elseif (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang}.js"))) {
         $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang}.js");
     }
     // bail early if no language
     if (!$src) {
         return;
     }
     // scripts
     wp_enqueue_script('select2-l10n', $src, '', $version, true);
 }
开发者ID:wearegiants,项目名称:EightyTwo,代码行数:37,代码来源:select.php

示例14: mb_locations

 function mb_locations()
 {
     include acf_get_path('admin/views/field-group-locations.php');
 }
开发者ID:pellio11,项目名称:ns-select-project,代码行数:4,代码来源:field-group.php

示例15: wp_init

 function wp_init()
 {
     // vars
     $cap = acf_get_setting('capability');
     $version = acf_get_setting('version');
     $lang = get_locale();
     $scripts = array();
     $styles = array();
     $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     // redeclare dir - allow another plugin to modify dir (maybe force SSL)
     acf_update_setting('dir', plugin_dir_url(__FILE__));
     // set text domain
     load_textdomain('acf', acf_get_path('lang/acf-' . get_locale() . '.mo'));
     $my_register_post_type = 'register_' . 'post_type';
     $my_register_post_type('acf-field-group', array('labels' => array('name' => __('Field Groups', 'acf'), 'singular_name' => __('Field Group', 'acf'), 'add_new' => __('Add New', 'acf'), 'add_new_item' => __('Add New Field Group', 'acf'), 'edit_item' => __('Edit Field Group', 'acf'), 'new_item' => __('New Field Group', 'acf'), 'view_item' => __('View Field Group', 'acf'), 'search_items' => __('Search Field Groups', 'acf'), 'not_found' => __('No Field Groups found', 'acf'), 'not_found_in_trash' => __('No Field Groups found in Trash', 'acf')), 'public' => false, 'show_ui' => true, '_builtin' => false, 'capability_type' => 'post', 'capabilities' => array('edit_post' => $cap, 'delete_post' => $cap, 'edit_posts' => $cap, 'delete_posts' => $cap), 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_menu' => false));
     $my_register_post_type('acf-field', array('labels' => array('name' => __('Fields', 'acf'), 'singular_name' => __('Field', 'acf'), 'add_new' => __('Add New', 'acf'), 'add_new_item' => __('Add New Field', 'acf'), 'edit_item' => __('Edit Field', 'acf'), 'new_item' => __('New Field', 'acf'), 'view_item' => __('View Field', 'acf'), 'search_items' => __('Search Fields', 'acf'), 'not_found' => __('No Fields found', 'acf'), 'not_found_in_trash' => __('No Fields found in Trash', 'acf')), 'public' => false, 'show_ui' => false, '_builtin' => false, 'capability_type' => 'post', 'capabilities' => array('edit_post' => $cap, 'delete_post' => $cap, 'edit_posts' => $cap, 'delete_posts' => $cap), 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'supports' => array('title'), 'show_in_menu' => false));
     /*
     
     		// register post type 'acf-field-group'
     		register_post_type('acf-field-group', array(
     			'labels'			=> array(
     			    'name'					=> __( 'Field Groups', 'acf' ),
     				'singular_name'			=> __( 'Field Group', 'acf' ),
     			    'add_new'				=> __( 'Add New' , 'acf' ),
     			    'add_new_item'			=> __( 'Add New Field Group' , 'acf' ),
     			    'edit_item'				=> __( 'Edit Field Group' , 'acf' ),
     			    'new_item'				=> __( 'New Field Group' , 'acf' ),
     			    'view_item'				=> __( 'View Field Group', 'acf' ),
     			    'search_items'			=> __( 'Search Field Groups', 'acf' ),
     			    'not_found'				=> __( 'No Field Groups found', 'acf' ),
     			    'not_found_in_trash'	=> __( 'No Field Groups found in Trash', 'acf' ), 
     			),
     			'public'			=> false,
     			'show_ui'			=> true,
     			'_builtin'			=> false,
     			'capability_type'	=> 'post',
     			'capabilities'		=> array(
     				'edit_post'			=> $cap,
     				'delete_post'		=> $cap,
     				'edit_posts'		=> $cap,
     				'delete_posts'		=> $cap,
     			),
     			'hierarchical'		=> true,
     			'rewrite'			=> false,
     			'query_var'			=> false,
     			'supports' 			=> array('title'),
     			'show_in_menu'		=> false,
     		));
     		// register post type 'acf-field'
     		register_post_type('acf-field', array(
     			'labels'			=> array(
     			    'name'					=> __( 'Fields', 'acf' ),
     				'singular_name'			=> __( 'Field', 'acf' ),
     			    'add_new'				=> __( 'Add New' , 'acf' ),
     			    'add_new_item'			=> __( 'Add New Field' , 'acf' ),
     			    'edit_item'				=> __( 'Edit Field' , 'acf' ),
     			    'new_item'				=> __( 'New Field' , 'acf' ),
     			    'view_item'				=> __( 'View Field', 'acf' ),
     			    'search_items'			=> __( 'Search Fields', 'acf' ),
     			    'not_found'				=> __( 'No Fields found', 'acf' ),
     			    'not_found_in_trash'	=> __( 'No Fields found in Trash', 'acf' ), 
     			),
     			'public'			=> false,
     			'show_ui'			=> false,
     			'_builtin'			=> false,
     			'capability_type'	=> 'post',
     			'capabilities'		=> array(
     				'edit_post'			=> $cap,
     				'delete_post'		=> $cap,
     				'edit_posts'		=> $cap,
     				'delete_posts'		=> $cap,
     			),
     			'hierarchical'		=> true,
     			'rewrite'			=> false,
     			'query_var'			=> false,
     			'supports' 			=> array('title'),
     			'show_in_menu'		=> false,
     		));
     */
     // register post status
     register_post_status('acf-disabled', array('label' => __('Disabled', 'acf'), 'public' => true, 'exclude_from_search' => false, 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, 'label_count' => _n_noop('Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'acf')));
     // append scripts
     $scripts['select2'] = array('src' => acf_get_dir("assets/inc/select2/select2{$min}.js"), 'deps' => array('jquery'));
     $scripts['acf-input'] = array('src' => acf_get_dir("assets/js/acf-input{$min}.js"), 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-resizable', 'jquery-ui-datepicker', 'wp-color-picker', 'select2'));
     $scripts['acf-field-group'] = array('src' => acf_get_dir("assets/js/acf-field-group{$min}.js"), 'deps' => array('acf-input'));
     // select2-l10n
     if ($lang) {
         // vars
         $lang = str_replace('_', '-', $lang);
         $lang_code = substr($lang, 0, 2);
         $src = '';
         // attempt 1
         if (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang_code}.js"))) {
             $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang_code}.js");
         } elseif (file_exists(acf_get_path("assets/inc/select2/select2_locale_{$lang}.js"))) {
             $src = acf_get_dir("assets/inc/select2/select2_locale_{$lang}.js");
         }
         // only append if file exists
         if ($src) {
             // append script
//.........这里部分代码省略.........
开发者ID:de190909,项目名称:WPTest,代码行数:101,代码来源:acf.php


注:本文中的acf_get_path函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。