本文整理汇总了PHP中acf_add_local_field_group函数的典型用法代码示例。如果您正苦于以下问题:PHP acf_add_local_field_group函数的具体用法?PHP acf_add_local_field_group怎么用?PHP acf_add_local_field_group使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了acf_add_local_field_group函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup_settings_page
public static function setup_settings_page()
{
if (function_exists('acf_add_options_page')) {
acf_add_options_sub_page(array('page_title' => 'Fruit Pack Settings', 'menu_title' => 'Fruit Pack Settings', 'parent_slug' => 'plugins.php'));
}
if (function_exists('acf_add_local_field_group')) {
acf_add_local_field_group(array('key' => 'group_563931a6e6559', 'title' => 'Github Settings', 'fields' => array(array('key' => 'field_563931bfe4a0b', 'label' => 'Github Username', 'name' => 'github_username', 'type' => 'text', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'maxlength' => '', 'readonly' => 0, 'disabled' => 0), array('key' => 'field_563931f1e4a0c', 'label' => 'Repository Slug', 'name' => 'repository_slug', 'type' => 'text', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'maxlength' => '', 'readonly' => 0, 'disabled' => 0), array('key' => 'field_563931ffe4a0d', 'label' => 'Authorization Key', 'name' => 'authorization_key', 'type' => 'text', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'maxlength' => '', 'readonly' => 0, 'disabled' => 0)), 'location' => array(array(array('param' => 'options_page', 'operator' => '==', 'value' => 'acf-options-fruit-pack-settings'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => ''));
}
}
示例2: register_field_group
function register_field_group($field_group)
{
// add local
acf_add_local_field_group($field_group);
}
示例3: htFeatureBlogposts
function htFeatureBlogposts()
{
parent::WP_Widget(false, __('HT Feature blogposts', 'govintranet'), array('description' => __('Blogpost listing widget', 'govintranet')));
if (function_exists('acf_add_local_field_group')) {
acf_add_local_field_group(array('key' => 'group_562a555eac132', 'title' => __('Feature blog widget', 'govintranet'), 'fields' => array(array('key' => 'field_562a555eb8501', 'label' => _x('Pin posts', 'Make stories sticky and appear at the top', 'govintranet'), 'name' => 'pin_posts', 'type' => 'relationship', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'post_type' => array(0 => 'news', 1 => 'blog', 2 => 'event'), 'taxonomy' => array(), 'filters' => array(0 => 'search', 1 => 'post_type'), 'elements' => '', 'min' => '', 'max' => '', 'return_format' => 'id')), 'location' => array(array(array('param' => 'widget', 'operator' => '==', 'value' => 'htfeatureblogposts'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'seamless', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => ''));
}
}
示例4: __construct
function __construct()
{
parent::__construct('htFeatureNews', __('HT Feature news', 'govintranet'), array('description' => __('Display feature news stories', 'govintranet')));
if (function_exists('acf_add_local_field_group')) {
acf_add_local_field_group(array('key' => 'group_54bfacd48f6e7', 'title' => __('Feature news widget', 'govintranet'), 'fields' => array(array('key' => 'field_560c502fb460c', 'label' => _x('News type', 'Categories for news', 'govintranet'), 'name' => 'news_listing_news_type', 'type' => 'taxonomy', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'taxonomy' => 'news-type', 'field_type' => 'checkbox', 'allow_null' => 1, 'add_term' => 0, 'save_terms' => 0, 'load_terms' => 0, 'return_format' => 'id', 'multiple' => 0), array('key' => 'field_54c03e5d0f3f4', 'label' => _x('Pin stories', 'Make news stories sticky and appear at the top', 'govintranet'), 'name' => 'pin_stories', 'type' => 'relationship', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'post_type' => array(0 => 'news', 1 => 'blog', 2 => 'event'), 'taxonomy' => array(), 'filters' => array(0 => 'search', 1 => 'post_type'), 'elements' => '', 'max' => '', 'return_format' => 'id', 'min' => 0), array('key' => 'field_54bfacd9a9fbb', 'label' => __('Exclude stories', 'govintranet'), 'name' => 'exclude_stories', 'type' => 'relationship', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'post_type' => array(0 => 'news'), 'taxonomy' => array(), 'filters' => array(0 => 'search'), 'elements' => '', 'max' => '', 'return_format' => 'id', 'min' => 0)), 'location' => array(array(array('param' => 'widget', 'operator' => '==', 'value' => 'htfeaturenews'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'seamless', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => ''));
}
}
示例5: init
/**
* Initialise the fields.
*
* @param array $locations The locations where we want this group to appear.
*/
public static function init($locations)
{
if (function_exists('acf_add_local_field_group')) {
add_filter('acf/format_value/type=repeater', [__CLASS__, 'format_background'], 10, 3);
acf_add_local_field_group(apply_filters('ln_elements_hero_group', array('key' => 'group_5731d0865aa2b', 'title' => 'Hero', 'fields' => array(array('key' => self::HEADLINE, 'label' => 'Headline', 'name' => 'hero_headline', 'type' => 'text', 'instructions' => 'The main headline of the hero section.', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'maxlength' => '', 'readonly' => 0, 'disabled' => 0), array('key' => self::TAGLINE, 'label' => 'Tagline', 'name' => 'hero_tagline', 'type' => 'textarea', 'instructions' => 'Appears below the headline.', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'default_value' => '', 'placeholder' => '', 'maxlength' => '', 'rows' => 2, 'new_lines' => 'wpautop', 'readonly' => 0, 'disabled' => 0), array('key' => self::BACKGROUND, 'label' => 'Background', 'name' => 'hero_background', 'type' => 'repeater', 'instructions' => 'Set the background. It can be either and image slider, a video or none.', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'collapsed' => '', 'min' => 1, 'max' => 1, 'layout' => 'block', 'button_label' => 'Add Row', 'sub_fields' => array(array('key' => 'field_575076d822dc8', 'label' => 'Type', 'name' => 'type', 'type' => 'radio', 'instructions' => 'The background type.', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'choices' => array('images' => 'Image Slider', 'video' => 'Video', 'none' => 'None'), 'other_choice' => 0, 'save_other_choice' => 0, 'default_value' => 'Image', 'layout' => 'horizontal'), array('key' => 'field_575076f222dc9', 'label' => 'Image Slider', 'name' => 'images', 'type' => 'gallery', 'instructions' => 'Select the images for the background slider. Just select a single image for a static background.', 'required' => 0, 'conditional_logic' => array(array(array('field' => 'field_575076d822dc8', 'operator' => '==', 'value' => 'images'))), 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'min' => 1, 'max' => 10, 'preview_size' => 'thumbnail', 'library' => 'all', 'min_width' => 3200, 'min_height' => 1340, 'min_size' => '', 'max_width' => '', 'max_height' => '', 'max_size' => '', 'mime_types' => ''), array('key' => 'field_57c4af53a7950', 'label' => 'Video', 'name' => 'video', 'type' => 'file', 'instructions' => 'Upload the background video. MP4 only.', 'required' => 1, 'conditional_logic' => array(array(array('field' => 'field_575076d822dc8', 'operator' => '==', 'value' => 'video'))), 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'return_format' => 'url', 'library' => 'all', 'min_size' => '', 'max_size' => '', 'mime_types' => 'mp4'), array('key' => 'field_57c4af53a7951', 'label' => 'Fallback Image', 'name' => 'fallback_image', 'type' => 'image', 'instructions' => 'Add an image to be used on mobile devices when the video can\'t be loaded', 'required' => 1, 'conditional_logic' => array(array(array('field' => 'field_575076d822dc8', 'operator' => '==', 'value' => 'video'))), 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'return_format' => 'array', 'preview_size' => 'thumbnail', 'library' => 'all', 'min_width' => 3200, 'min_height' => 1340, 'min_size' => '', 'max_width' => '', 'max_height' => '', 'max_size' => '', 'mime_types' => ''))), array('key' => self::CTA, 'label' => 'Call To Action', 'name' => 'hero_cta', 'type' => 'repeater', 'instructions' => 'The button in the hero section.', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'collapsed' => 'field_5731d0ee81bb3', 'min' => 1, 'max' => 1, 'layout' => 'table', 'button_label' => 'Add Row', 'sub_fields' => array(array('key' => 'field_5731d0ee81bb3', 'label' => 'Label', 'name' => 'label', 'type' => 'text', 'instructions' => 'The CTA\'s label.', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'maxlength' => '', 'readonly' => 0, 'disabled' => 0), array('key' => 'field_5731d0fb81bb4', 'label' => 'Link', 'name' => 'link', 'type' => 'text', 'instructions' => 'The link the CTA leads to.', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'default_value' => '', 'placeholder' => 'http://...', 'prepend' => '', 'append' => '', 'maxlength' => '', 'readonly' => 0, 'disabled' => 0), array('key' => 'field_5731d11881bb5', 'label' => 'New Window', 'name' => 'new_window', 'type' => 'true_false', 'instructions' => 'Open the link in a new window.', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'message' => '', 'default_value' => 0)))), 'location' => $locations, 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => array(0 => 'the_content'), 'active' => 1, 'description' => '')));
}
}
示例6: __construct
function __construct()
{
parent::__construct('htFeatureBlogposts', __('HT Feature blogposts', 'govintranet'), array('description' => __('Blogpost listing widget', 'govintranet')));
if (function_exists('acf_add_local_field_group')) {
acf_add_local_field_group(array('key' => 'group_562a555eac132', 'title' => 'Feature blog widget', 'fields' => array(array('key' => 'field_562a555eb8501', 'label' => 'Pin posts', 'name' => 'pin_posts', 'type' => 'relationship', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'post_type' => array(0 => 'news', 1 => 'blog', 2 => 'event'), 'taxonomy' => array(), 'filters' => array(0 => 'search', 1 => 'post_type'), 'elements' => '', 'min' => '', 'max' => '', 'return_format' => 'id'), array('key' => 'field_56b9356df717b', 'label' => 'Blog categories', 'name' => 'blog_categories', 'type' => 'taxonomy', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'taxonomy' => 'blog-category', 'field_type' => 'checkbox', 'allow_null' => 1, 'add_term' => 0, 'save_terms' => 0, 'load_terms' => 0, 'return_format' => 'id', 'multiple' => 0)), 'location' => array(array(array('param' => 'widget', 'operator' => '==', 'value' => 'htfeatureblogposts'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'seamless', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => ''));
}
}
示例7: registerFieldGroups
/**
* Registers the field groups after all rules have been collected
*/
public static function registerFieldGroups()
{
foreach (self::$fieldGroups as $key => $fieldGroup) {
$fieldGroup['location'] = self::$rules[$key];
if (function_exists(acf_add_local_field_group)) {
\acf_add_local_field_group($fieldGroup);
}
}
}
示例8: include_fields
public function include_fields()
{
// get post types and taxonomies and make sure they are related
if (!function_exists('acf_add_local_field_group')) {
return;
}
do_action('ssi-breadcrumbs/get-post-types-and-taxonomies');
// build and include field group
$fields = $this->build_fields();
$group = array('key' => 'group_ssibreadcrumbs', 'title' => 'Breadcrumb Settings', 'fields' => $fields, 'location' => array(array(array('param' => 'options_page', 'operator' => '==', 'value' => 'ssi-breadcrumbs'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'left', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => '');
acf_add_local_field_group($group);
}
示例9: createUserGroupPostType
public function createUserGroupPostType()
{
$labels = array('name' => _x('UserGroups', 'Post Type General Name', 'phpwomen_posts_usergroup'), 'singular_name' => _x('UserGroup', 'Post Type Singular Name', 'phpwomen_posts_usergroup'), 'menu_name' => __('UserGroups', 'phpwomen_posts_usergroup'), 'name_admin_bar' => __('UserGroups', 'phpwomen_posts_usergroup'), 'parent_item_colon' => __('Parent Item:', 'phpwomen_posts_usergroup'), 'all_items' => __('All UserGroups', 'phpwomen_posts_usergroup'), 'add_new_item' => __('Add New UserGroup', 'phpwomen_posts_usergroup'), 'add_new' => __('Add New', 'phpwomen_posts_usergroup'), 'new_item' => __('New UserGroup', 'phpwomen_posts_usergroup'), 'edit_item' => __('Edit UserGroup', 'phpwomen_posts_usergroup'), 'update_item' => __('Update UserGroup', 'phpwomen_posts_usergroup'), 'view_item' => __('View UserGroup', 'phpwomen_posts_usergroup'), 'search_items' => __('Search UserGroup', 'phpwomen_posts_usergroup'), 'not_found' => __('Not found', 'phpwomen_posts_usergroup'), 'not_found_in_trash' => __('Not found in Trash', 'phpwomen_posts_usergroup'));
$rewrite = array('slug' => 'usergroup', 'with_front' => true, 'pages' => true, 'feeds' => true);
$args = array('label' => __('phpw_usergroup', 'phpwomen_posts_usergroup'), 'description' => __('Post Type Description', 'phpwomen_posts_usergroup'), 'labels' => $labels, 'supports' => array('title', 'editor'), 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-universal-access-alt', 'show_in_admin_bar' => true, 'show_in_nav_menus' => true, 'can_export' => true, 'has_archive' => true, 'exclude_from_search' => true, 'publicly_queryable' => false, 'rewrite' => $rewrite, 'capability_type' => 'page');
register_post_type('phpw_usergroup', $args);
if (function_exists('acf_add_local_field_group')) {
if (function_exists('acf_add_local_field_group')) {
acf_add_local_field_group(array('key' => 'group_5558e5cd37bd5', 'title' => 'UserGroup Settings', 'fields' => array(array('key' => 'field_5558e5e700f72', 'label' => 'UserGroup Logo', 'name' => 'usergroup_logo', 'type' => 'image', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'return_format' => 'url', 'preview_size' => 'thumbnail', 'library' => 'uploadedTo', 'min_width' => '', 'min_height' => '', 'min_size' => '', 'max_width' => '', 'max_height' => '', 'max_size' => '', 'mime_types' => ''), array('key' => 'field_5558e66200f74', 'label' => 'UserGroup Website', 'name' => 'usergroup_website', 'type' => 'url', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'default_value' => '', 'placeholder' => ''), array('key' => 'field_5558e64500f73', 'label' => 'UserGroup Location', 'name' => 'usergroup_location', 'type' => 'text', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'maxlength' => '', 'readonly' => 0, 'disabled' => 0), array('key' => 'field_5558e69800f75', 'label' => 'UserGroup Meeting Schedule', 'name' => 'usergroup_schedule', 'type' => 'text', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'default_value' => '', 'placeholder' => '', 'prepend' => '', 'append' => '', 'maxlength' => '', 'readonly' => 0, 'disabled' => 0)), 'location' => array(array(array('param' => 'post_type', 'operator' => '==', 'value' => 'phpw_usergroup'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => ''));
}
}
}
示例10: setup_acfpro
function setup_acfpro()
{
$theme_plugins = new RequiredPlugins();
$theme_plugins->add_plugin($this->plugin);
$theme_plugins->init();
if (class_exists('acf_pro') && function_exists('acf_add_local_field_group')) {
$acf_fields = array('key' => $this->posttype_slug, 'title' => 'Theme options', 'fields' => array(array('key' => $this->posttype_slug . '_update_time', 'label' => 'Event should reoccur', 'name' => $this->posttype_slug . '_update_time', 'type' => 'select', 'choices' => array('hourly' => 'Hourly', 'twicedaily' => 'Twicedaily', 'daily' => 'Daily')), array('key' => $this->posttype_slug . '_service_link', 'label' => 'Service Link', 'name' => $this->posttype_slug . '_service_link', 'type' => 'text')), 'location' => array(array(array('param' => 'options_page', 'operator' => '==', 'value' => 'acf-options-theme-options'))));
acf_add_local_field_group($acf_fields);
return true;
} else {
return false;
}
}
示例11: addArchiveOptions
/**
* Adds archive options fields
*/
public function addArchiveOptions()
{
if (!function_exists('acf_add_local_field_group')) {
return;
}
$posttypes = get_post_types();
$posttypes = array_filter($posttypes, function ($value) {
if (substr($value, 0, 4) === 'mod-' || substr($value, 0, 4) === 'acf-' || in_array($value, array('attachment', 'revision', 'nav_menu_item', 'page', 'custom-short-link'))) {
return apply_filters('Municipio/archives/canChangeStyle', false, $value);
}
return true;
});
foreach ($posttypes as $posttype) {
// Get posttype taxonommies
$taxonomies = array();
$taxonomiesRaw = get_object_taxonomies($posttype);
foreach ($taxonomiesRaw as $taxonomy) {
$taxonomies[$taxonomy] = $taxonomy;
}
$fieldArgs = array('key' => 'group_' . md5($posttype), 'title' => __('Archive for', 'municipio') . ': ' . ucwords($posttype), 'fields' => array(), 'location' => array(array(array('param' => 'options_page', 'operator' => '==', 'value' => 'acf-options-archives'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => '');
// Feed display label
$fieldArgs['fields'][] = array('key' => 'field_570e104caf1b2_' . md5($posttype), 'label' => 'Archive feed display settings', 'name' => 'archive_' . sanitize_title($posttype) . '_feed_display_settings', 'type' => 'message', 'instructions' => 'The below settings will apply for the archive feed.', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => 'municipio-theme-options-label', 'id' => ''), 'message' => '', 'new_lines' => 'wpautop', 'esc_html' => 0);
// Post style
$fieldArgs['fields'][] = array('key' => 'field_56f00fe21f918_' . md5($posttype), 'label' => 'Post style', 'name' => 'archive_' . sanitize_title($posttype) . '_post_style', 'type' => 'select', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'choices' => array('full' => 'Full', 'collapsed' => 'Collapsed', 'compressed' => 'Compressed', 'grid' => 'Grid', 'cards' => 'Post cards', 'newsitem' => 'News items'), 'default_value' => array(0 => 'full'), 'allow_null' => 0, 'multiple' => 0, 'ui' => 0, 'ajax' => 0, 'placeholder' => '', 'disabled' => 0, 'readonly' => 0);
// Grid columns
$fieldArgs['fields'][] = array('key' => 'field_56f1045257121_' . md5($posttype), 'label' => 'Grid columns', 'name' => 'archive_' . sanitize_title($posttype) . '_grid_columns', 'type' => 'select', 'instructions' => '', 'required' => 0, 'conditional_logic' => array(array(array('field' => 'field_56f00fe21f918_' . md5($posttype), 'operator' => '==', 'value' => 'grid')), array(array('field' => 'field_56f00fe21f918_' . md5($posttype), 'operator' => '==', 'value' => 'cards'))), 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'choices' => array('grid-md-12' => 1, 'grid-md-6' => 2, 'grid-md-4' => 3, 'grid-md-3' => 4), 'default_value' => array(0 => 'grid-md-12'), 'allow_null' => 0, 'multiple' => 0, 'ui' => 0, 'ajax' => 0, 'placeholder' => '', 'disabled' => 0, 'readonly' => 0);
// Post sorting
$metaKeys = array('post_date' => 'Date published', 'post_modified' => 'Date modified', 'post_title' => 'Title');
$metaKeysRaw = \Municipio\Helper\Post::getPosttypeMetaKeys($posttype);
foreach ($metaKeysRaw as $metaKey) {
$metaKeys[$metaKey->meta_key] = $metaKey->meta_key;
}
$fieldArgs['fields'][] = array('key' => 'field_56f64546rref918_' . md5($posttype), 'label' => 'Sort on', 'name' => 'archive_' . sanitize_title($posttype) . '_sort_key', 'type' => 'select', 'instructions' => '', 'required' => 1, 'conditional_logic' => 0, 'wrapper' => array('width' => '50%', 'class' => '', 'id' => ''), 'choices' => apply_filters('Municipio/archive/sort_keys', $metaKeys, $posttype), 'default_value' => array(0 => 'post_date'), 'allow_null' => 0, 'multiple' => 0, 'ui' => 0, 'ajax' => 0, 'placeholder' => '', 'disabled' => 0, 'readonly' => 0);
$fieldArgs['fields'][] = array('key' => 'field_56fwe545ergref918_' . md5($posttype), 'label' => 'Order', 'name' => 'archive_' . sanitize_title($posttype) . '_sort_order', 'type' => 'select', 'instructions' => '', 'required' => 1, 'conditional_logic' => 0, 'wrapper' => array('width' => '50%', 'class' => '', 'id' => ''), 'choices' => array('asc' => 'Ascending', 'desc' => 'Descending'), 'default_value' => array(0 => 'desc'), 'allow_null' => 0, 'multiple' => 0, 'ui' => 0, 'ajax' => 0, 'placeholder' => '', 'disabled' => 0, 'readonly' => 0);
// Post filters
$fieldArgs['fields'][] = array('key' => 'field_570ba0c87756c' . md5($posttype), 'label' => 'Post filters', 'name' => 'archive_' . sanitize_title($posttype) . '_post_filters_header', 'type' => 'checkbox', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'choices' => array('text_search' => 'Text search', 'date_range' => 'Date range'), 'default_value' => array(), 'layout' => 'horizontal', 'toggle' => 0);
// Post filters sidebar
if (count($taxonomies) > 0) {
$fieldArgs['fields'][] = array('key' => 'field_570ba0c8erg434' . md5($posttype), 'label' => 'Taxonomy filters', 'name' => 'archive_' . sanitize_title($posttype) . '_post_filters_sidebar', 'type' => 'checkbox', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'choices' => $taxonomies, 'default_value' => array(), 'layout' => 'horizontal', 'toggle' => 0);
}
// Publish date
$fieldArgs['fields'][] = array('key' => 'field_56fcc6914296b_' . md5($posttype), 'label' => 'Date published', 'name' => 'archive_' . sanitize_title($posttype) . '_feed_date_published', 'type' => 'radio', 'instructions' => '', 'required' => 1, 'conditional_logic' => 0, 'wrapper' => array('width' => '50%', 'class' => '', 'id' => ''), 'choices' => array('false' => 'Do not show', 'datetime' => 'Date and time', 'date' => 'Date only', 'time' => 'Time only'), 'other_choice' => 0, 'save_other_choice' => 0, 'default_value' => 'datetime', 'layout' => 'horizontal');
// Sidebar navigation
$fieldArgs['fields'][] = array('key' => 'field_570ded8a47206_' . md5($posttype), 'label' => 'Sidebar navigation', 'name' => 'archive_' . sanitize_title($posttype) . '_show_sidebar_navigation', 'type' => 'true_false', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '50%', 'class' => '', 'id' => ''), 'message' => 'Yes, show the sidebar navigation', 'default_value' => 0);
// Post display label
$fieldArgs['fields'][] = array('key' => 'field_570e104caf1b3_' . md5($posttype), 'label' => 'Post display settings', 'name' => 'archive_' . sanitize_title($posttype) . '_post_display_settings', 'type' => 'message', 'instructions' => 'The below settings will apply for single post view.', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => 'municipio-theme-options-label', 'id' => ''), 'message' => '', 'new_lines' => 'wpautop', 'esc_html' => 0);
$fieldArgs['fields'][] = array('key' => 'field_56fcc6914296c_' . md5($posttype), 'label' => 'Date published', 'name' => 'archive_' . sanitize_title($posttype) . '_post_date_published', 'type' => 'radio', 'instructions' => '', 'required' => 1, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'choices' => array('false' => 'Do not show', 'datetime' => 'Date and time', 'date' => 'Date only', 'time' => 'Time only'), 'other_choice' => 0, 'save_other_choice' => 0, 'default_value' => 'datetime', 'layout' => 'horizontal');
$fieldArgs['fields'][] = array('key' => 'field_56fcc62b8ab02_' . md5($posttype), 'label' => 'Info to display', 'name' => 'archive_' . sanitize_title($posttype) . '_post_display_info', 'type' => 'checkbox', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'choices' => array('category' => 'Show category', 'tags' => 'Show tags', 'author' => 'Show author', 'author_image' => 'Show autor image (only if show author)'), 'other_choice' => 0, 'save_other_choice' => 0, 'default_value' => '', 'layout' => 'horizontal');
acf_add_local_field_group($fieldArgs);
}
}
示例12: register_fields
public static function register_fields()
{
if (!function_exists('acf_add_local_field_group')) {
return;
}
$postTypes = get_post_types(array('public' => true), 'objects');
if (!$postTypes) {
return;
}
$i = 0;
foreach ($postTypes as $postType) {
$i++;
$fields = apply_filters('fp_archive_meta_fields', array(), $i, $postType);
acf_add_local_field_group(array('key' => 'group_56c2ae1db5b5' . $i, 'title' => $postType->labels->singular_name . ' Archive Settings', 'fields' => $fields, 'location' => array(array(array('param' => 'options_page', 'operator' => '==', 'value' => 'acf-options-archive-settings'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'standard', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => ''));
}
}
示例13: acfav_init
function acfav_init()
{
add_filter('acf/location/rule_values/attachment', 'acfav_acf_location_rules_values_attachment');
function acfav_acf_location_rules_values_attachment($choices)
{
$choices['video'] = 'Video';
return $choices;
}
add_filter('acf/location/rule_match/attachment', 'acfav_acf_location_rules_match_attachment', 10, 3);
function acfav_acf_location_rules_match_attachment($match, $rule, $options)
{
// vars
if (empty($options)) {
return false;
}
$attachment = $options['attachment'];
// validate
if (!$attachment) {
return false;
}
// compare
if ($rule['operator'] == "==") {
$match = $attachment == $rule['value'];
if ($rule['value'] == "video") {
global $post;
if (empty($post)) {
return false;
}
return substr($post->post_mime_type, 0, 5) == 'video';
}
// override for "all"
if ($rule['value'] == "all") {
$match = true;
}
} elseif ($rule['operator'] == "!=") {
$match = $attachment != $rule['value'];
// override for "all"
if ($rule['value'] == "all") {
$match = false;
}
}
return $match;
}
if (function_exists('acf_add_local_field_group')) {
acf_add_local_field_group(array('key' => 'group_561274370036a', 'title' => 'Accessible video', 'fields' => array(array('key' => 'field_561274902b283', 'label' => __('Alternative video files', ACFAV_DOMAIN), 'name' => 'acfav_alt_videos', 'type' => 'repeater', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'min' => '', 'max' => '', 'layout' => 'table', 'button_label' => __('Add another video file', ACFAV_DOMAIN), 'sub_fields' => array(array('key' => 'field_561274aa2b284', 'label' => __('Alternative video file', ACFAV_DOMAIN), 'name' => 'acfav_alt_video', 'type' => 'file', 'instructions' => __('For example .wmv or .mov. <br />Note: if the files are to big to upload here, please upload them via FTP and assign them to the media using a plugin like Media from FTP', ACFAV_DOMAIN), 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'return_format' => 'array', 'library' => 'all', 'min_size' => '', 'max_size' => '', 'mime_types' => ''))), array('key' => 'field_561275072b285', 'label' => __('Alternative audio files', ACFAV_DOMAIN), 'name' => 'acfav_alt_audios', 'type' => 'repeater', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'min' => '', 'max' => '', 'layout' => 'table', 'button_label' => __('Add another audio file', ACFAV_DOMAIN), 'sub_fields' => array(array('key' => 'field_sub561275072b285', 'label' => __('Alternative audio file', ACFAV_DOMAIN), 'name' => 'acfav_alt_audio', 'type' => 'file', 'instructions' => __('For example .mp3 or .wav', ACFAV_DOMAIN), 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'return_format' => 'array', 'library' => 'all', 'min_size' => '', 'max_size' => '', 'mime_types' => ''))), array('key' => 'field_561275402b286', 'label' => __('Subtitles', ACFAV_DOMAIN), 'name' => 'acfav_subtitles', 'type' => 'repeater', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'min' => '', 'max' => '', 'layout' => 'table', 'button_label' => __('Add another subtitle file', ACFAV_DOMAIN), 'sub_fields' => array(array('key' => 'field_561275592b287', 'label' => 'Subtitle file', 'name' => 'acfav_srt_file', 'type' => 'file', 'instructions' => __('Use a .srt or .vvt file', ACFAV_DOMAIN), 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'return_format' => 'array', 'library' => 'all', 'min_size' => '', 'max_size' => '', 'mime_types' => 'srt, vvt'), array('key' => 'field_5612758e2b289', 'label' => __('Language subtitles', ACFAV_DOMAIN), 'name' => 'acfav_srt_language', 'type' => 'select', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'choices' => array('af' => 'Afrikaans', 'ar' => 'العربية', 'az' => 'Azərbaycan dili', 'bg' => 'Български', 'bs' => 'Bosanski', 'ca' => 'Català', 'cy' => 'Cymraeg', 'da' => 'Dansk', 'de' => 'Deutsch', 'el' => 'Ελληνικά', 'en' => 'English', 'eo' => 'Esperanto', 'es' => 'Español', 'et' => 'Eesti', 'eu' => 'Euskara', 'fa' => 'فارسی', 'fi' => 'Suomi', 'fr' => 'Français', 'gd' => 'Gàidhlig', 'gl' => 'Galego', 'haz' => 'هزاره گی', 'he' => 'עִבְרִית', 'hr' => 'Hrvatski', 'hu' => 'Magyar', 'id' => 'Bahasa Indonesia', 'is' => 'Íslenska', 'it' => 'Italiano', 'ja' => '日本語', 'ko' => '한국어', 'lt' => 'Lietuvių kalba', 'my' => 'ဗမာစာ', 'nb' => 'Norsk bokmål', 'nl' => 'Nederlands', 'nn' => 'Norsk nynorsk', 'oc' => 'Occitan', 'pl' => 'Polski', 'ps' => 'پښتو', 'pt' => 'Português', 'ro' => 'Română', 'ru' => 'Русский', 'sk' => 'Slovenčina', 'sl' => 'Slovenščina', 'sq' => 'Shqip', 'sr' => 'Српски језик', 'sv' => 'Svenska', 'th' => 'ไทย', 'tl' => 'Tagalog', 'tr' => 'Türkçe', 'ug' => 'Uyƣurqə', 'uk' => 'Українська', 'zh' => '繁體中文'), 'default_value' => array('en' => 'en'), 'allow_null' => 0, 'multiple' => 0, 'ui' => 0, 'ajax' => 0, 'placeholder' => '', 'disabled' => 0, 'readonly' => 0)))), 'location' => array(array(array('param' => 'attachment', 'operator' => '==', 'value' => 'video'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => 1, 'description' => ''));
}
}
示例14: include_fields
public function include_fields()
{
$path = dirname(__FILE__) . '/acf-json';
if (!is_dir($path) || ($files = scandir($path)) === false || !count($files)) {
return;
}
$groups = $this->get_acf_field_groups();
foreach ($files as $file) {
$file_path = $path . '/' . $file;
if (is_dir($file_path) || !preg_match('/\\.json$/', $file)) {
continue;
}
$group_key = preg_replace('/\\.json$/', '', $file);
if (!isset($groups[$group_key]) && ($json = file_get_contents($file_path)) !== false && ($field_group = json_decode($json, true)) !== NULL) {
acf_add_local_field_group($field_group);
}
}
// need to delete the ACF cache
wp_cache_delete('get_field_groups', 'acf');
}
示例15: _e
?>
"><?php
_e('Show recent', 'govintranet');
?>
</label> <br><br>
<label for="<?php
echo $this->get_field_id('cacheperiod');
?>
"><?php
_e('Cache (minutes):', 'govintranet');
?>
</label>
<input class="widefat" id="<?php
echo $this->get_field_id('cacheperiod');
?>
" name="<?php
echo $this->get_field_name('cacheperiod');
?>
" type="text" value="<?php
echo $cacheperiod;
?>
" /><br>
</p>
<?php
}
}
if (function_exists('acf_add_local_field_group')) {
acf_add_local_field_group(array('key' => 'group_55ee1a9ecbd0d', 'title' => __('Limit event types', 'govintranet'), 'fields' => array(array('key' => 'field_55ee1ab48bb29', 'label' => __('Event types', 'govintranet'), 'name' => 'event_listing_event_types', 'type' => 'taxonomy', 'instructions' => '', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array('width' => '', 'class' => '', 'id' => ''), 'taxonomy' => 'event-type', 'field_type' => 'checkbox', 'allow_null' => 1, 'add_term' => 0, 'save_terms' => 0, 'load_terms' => 0, 'return_format' => 'id', 'multiple' => 0)), 'location' => array(array(array('param' => 'widget', 'operator' => '==', 'value' => 'hteventslisting'))), 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => ''));
}
add_action('widgets_init', create_function('', 'return register_widget("htEventsListing");'));