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


PHP acf_Field类代码示例

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


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

示例1:

 function __construct($parent)
 {
     parent::__construct($parent);
     $this->parent = $parent;
     $this->name = 'widget_template_relationship';
     $this->title = __('Widget Template Relationship', 'acf');
 }
开发者ID:troubletribbles,项目名称:dr_bootstrap,代码行数:7,代码来源:widget_template_relationship.php

示例2: array

 function __construct()
 {
     $this->name = 'acf_google_maps';
     $this->label = 'Google Map Address Lookup';
     // do not delete!
     parent::__construct($parent);
     add_action('save_post', array($this, 'save_lat_lng'));
 }
开发者ID:felipegenuino,项目名称:rtaonline-novo,代码行数:8,代码来源:main.php

示例3: array

 function __construct()
 {
     // vars
     $this->name = 'website';
     $this->label = __('Website');
     $this->defaults = array('default_value' => '', 'internal_link' => 0, 'website_title' => 0, 'output_format' => 0);
     // do not delete!
     parent::__construct();
 }
开发者ID:fullthoughtcc,项目名称:wp-presenter,代码行数:9,代码来源:website_url_v4.php

示例4: array

 function __construct($parent)
 {
     // do not delete!
     parent::__construct($parent);
     // set name / title
     $this->name = 'hidden';
     $this->title = __('Hidden');
     $this->defaults = array();
     // settings
     $this->settings = array('path' => $this->helpers_get_path(__FILE__), 'dir' => $this->helpers_get_dir(__FILE__), 'version' => '1.0.0');
 }
开发者ID:slavic18,项目名称:casa,代码行数:11,代码来源:hidden-v3.php

示例5: floatval

 function update_value($post_id, $field, $value)
 {
     // remove ','
     $value = str_replace(',', '', $value);
     // convert to float. This removes any chars
     $value = floatval($value);
     // convert back to string. This alows decimals to save
     $value = (string) $value;
     // update value
     parent::update_value($post_id, $field, $value);
 }
开发者ID:mpaskew,项目名称:isc-dev,代码行数:11,代码来源:number.php

示例6: array

 function __construct($parent)
 {
     // do not delete!
     parent::__construct($parent);
     // set name / title
     $this->name = 'sidebar_selector';
     $this->title = __('Sidebar Selector', 'acf');
     $this->defaults = array('allow_null' => '1', 'default_value' => '');
     // settings
     $this->settings = array('path' => $this->helpers_get_path(__FILE__), 'dir' => $this->helpers_get_dir(__FILE__), 'version' => '1.0.0');
 }
开发者ID:mathewhtc,项目名称:cats-old,代码行数:11,代码来源:sidebar_selector-v3.php

示例7: array

 function __construct($parent)
 {
     parent::__construct($parent);
     // vars
     $this->name = 'google_font_selector';
     $this->label = __('Google Font Selector', 'acf');
     $this->category = __("Choice", 'acf');
     $this->defaults = array('include_web_safe' => true, 'default_font' => 'Droid Sans', 'interface' => 'advanced');
     parent::__construct();
     $api_key = defined('ACF_GOOGLE_FONTS_API_KEY') ? ACF_GOOGLE_FONTS_API_KEY : 'AIzaSyDprvtcGk0jQhIAIr0CdW7g57A5eRyesrc';
     $this->api_key = $api_key;
     $this->fonts = $this->get_google_fonts();
     $this->web_safe = $this->set_web_safe();
     $this->settings = array('path' => apply_filters('acf/helpers/get_path', __FILE__), 'dir' => apply_filters('acf/helpers/get_dir', __FILE__), 'version' => '1.0.0');
     add_action('wp_ajax_acfgfs_get_font_data', array($this, 'action_get_font_data'));
     if (!(defined('ACF_GOOGLE_FONTS_DISABLE_HEADER') && true == ACF_GOOGLE_FONTS_DISABLE_HEADER)) {
         add_action('wp_head', array($this, 'google_font_request'));
     }
 }
开发者ID:joedooley,项目名称:ACF-Google-Font-Selector,代码行数:19,代码来源:google_font_selector-v3.php

示例8:

 function get_value($post_id, $field)
 {
     // get value
     $value = parent::get_value($post_id, $field);
     // format value
     // return value
     return $value;
 }
开发者ID:hubdotcom,项目名称:User-Field-ACF-Add-on,代码行数:8,代码来源:users_field.php

示例9:

 function __construct($parent)
 {
     parent::__construct($parent);
     $this->name = 'color_picker';
     $this->title = __("Color Picker", 'acf');
 }
开发者ID:mpaskew,项目名称:isc-dev,代码行数:6,代码来源:color_picker.php

示例10: array

 function get_value_for_api($post_id, $field)
 {
     // vars
     $values = array();
     $total = 0;
     // get total rows
     $total = (int) parent::get_value($post_id, $field);
     if ($total > 0) {
         // loop through rows
         for ($i = 0; $i < $total; $i++) {
             // loop through sub fields
             foreach ($field['sub_fields'] as $sub_field) {
                 // store name
                 $field_name = $sub_field['name'];
                 // update full name
                 $sub_field['name'] = $field['name'] . '_' . $i . '_' . $field_name;
                 $values[$i][$field_name] = $this->parent->get_value_for_api($post_id, $sub_field);
             }
         }
         return $values;
     }
     return array();
 }
开发者ID:agentfitz,项目名称:thb,代码行数:23,代码来源:repeater.php

示例11: array

 function get_value_for_api($post_id, $field)
 {
     // vars
     $defaults = array('save_format' => 'object');
     $field = array_merge($defaults, $field);
     $value = parent::get_value($post_id, $field);
     // validate
     if (!$value) {
         return false;
     }
     // format
     if ($field['save_format'] == 'url') {
         $value = wp_get_attachment_url($value);
     } elseif ($field['save_format'] == 'object') {
         $attachment = get_post($value);
         // create array to hold value data
         $value = array('id' => $attachment->ID, 'alt' => get_post_meta($attachment->ID, '_wp_attachment_image_alt', true), 'title' => $attachment->post_title, 'caption' => $attachment->post_excerpt, 'description' => $attachment->post_content, 'url' => wp_get_attachment_url($attachment->ID));
     }
     return $value;
 }
开发者ID:agentfitz,项目名称:thb,代码行数:20,代码来源:file.php

示例12: array

 function get_value_for_api($post_id, $field)
 {
     $layouts = array();
     foreach ($field['layouts'] as $l) {
         $layouts[$l['name']] = $l;
     }
     // vars
     $values = array();
     $layout_order = false;
     // get total rows
     $layout_order = parent::get_value($post_id, $field);
     if ($layout_order) {
         $i = -1;
         // loop through rows
         foreach ($layout_order as $layout) {
             $i++;
             $values[$i]['acf_fc_layout'] = $layout;
             // loop through sub fields
             foreach ($layouts[$layout]['sub_fields'] as $sub_field) {
                 // store name
                 $field_name = $sub_field['name'];
                 // update full name
                 $sub_field['name'] = $field['name'] . '_' . $i . '_' . $field_name;
                 $values[$i][$field_name] = $this->parent->get_value_for_api($post_id, $sub_field);
             }
         }
         return $values;
     }
     return array();
 }
开发者ID:sriram911,项目名称:pls,代码行数:30,代码来源:flexible_content.php

示例13: date

 function get_value_for_api($post_id, $field)
 {
     $field = array_merge($this->defaults, $field);
     $value = parent::get_value($post_id, $field);
     if ($value != '' && $field['save_as_timestamp'] == 'true' && $field['get_as_timestamp'] != 'true' && $this->isValidTimeStamp($value)) {
         if ($field['show_date'] == 'true') {
             $value = date(sprintf("%s %s", $this->js_to_php_dateformat($field['date_format']), $this->js_to_php_timeformat($field['time_format'])), $value);
         } else {
             $value = date(sprintf("%s", $this->js_to_php_timeformat($field['time_format'])), $value);
         }
     }
     return $value;
 }
开发者ID:andresagraf,项目名称:summitmutual2016,代码行数:13,代码来源:date_time_picker-v3.php

示例14: explode

 function get_value($post_id, $field)
 {
     // get value
     $value = parent::get_value($post_id, $field);
     // empty?
     if (!$value) {
         return $value;
     }
     // Pre 3.3.3, the value is a string coma seperated
     if (!is_array($value)) {
         $value = explode(',', $value);
     }
     // empty?
     if (empty($value)) {
         return $value;
     }
     // find posts (DISTINCT POSTS)
     $posts = get_posts(array('numberposts' => -1, 'post__in' => $value, 'post_type' => get_post_types(array('public' => true)), 'post_status' => array('publish', 'private', 'draft', 'inherit', 'future')));
     $ordered_posts = array();
     foreach ($posts as $post) {
         // create array to hold value data
         $ordered_posts[$post->ID] = $post;
     }
     // override value array with attachments
     foreach ($value as $k => $v) {
         $value[$k] = $ordered_posts[$v];
     }
     // return value
     return $value;
 }
开发者ID:robjcordes,项目名称:nexnewwp,代码行数:30,代码来源:relationship.php

示例15: foreach

 function get_value_for_api($post_id, $field)
 {
     // get value
     $value = parent::get_value($post_id, $field);
     // format value
     if (!$value) {
         return false;
     }
     if ($value == 'null') {
         return false;
     }
     // load form data
     if (is_array($value)) {
         foreach ($value as $k => $v) {
             $form = RGFormsModel::get_form($v);
             $value[$k] = $form;
         }
     } else {
         $value = RGFormsModel::get_form($value);
     }
     // return value
     return $value;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:23,代码来源:gravity_forms-v3.php


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