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


PHP get_fields函数代码示例

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


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

示例1: prez

function prez($args = 'nope')
{
    $argType = gettype($args);
    if ($argType == 'string') {
        $prez = get_fields();
    } elseif ($argType == 'array') {
        $prez = $args;
    } elseif ($argType == 'integer') {
        $prez = get_fields($args);
    }
    echo '<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.2/highlight.min.js"></script>';
    echo '<script type="text/javascript">hljs.initHighlightingOnLoad();</script>';
    echo '<style>.hljs{display:block;overflow-x:auto;padding:.5em;background:#f0f0f0;-webkit-text-size-adjust:none}.apache .hljs-cbracket,.apache .hljs-tag,.asciidoc .hljs-header,.bash .hljs-variable,.coffeescript .hljs-attribute,.django .hljs-variable,.erlang_repl .hljs-function_or_atom,.haml .hljs-symbol,.hljs-addition,.hljs-constant,.hljs-flow,.hljs-parent,.hljs-pragma,.hljs-preprocessor,.hljs-rules .hljs-value,.hljs-stream,.hljs-string,.hljs-tag .hljs-value,.hljs-template_tag,.hljs-title,.markdown .hljs-header,.ruby .hljs-symbol,.ruby .hljs-symbol .hljs-string,.smalltalk .hljs-class,.tex .hljs-command,.tex .hljs-special{color:#800}.asciidoc .hljs-blockquote,.diff .hljs-header,.hljs-annotation,.hljs-chunk,.hljs-comment,.hljs-template_comment,.markdown .hljs-blockquote,.smartquote{color:#888}.asciidoc .hljs-bullet,.asciidoc .hljs-link_url,.go .hljs-constant,.hljs-change,.hljs-date,.hljs-hexcolor,.hljs-literal,.hljs-number,.hljs-regexp,.lasso .hljs-variable,.makefile .hljs-variable,.markdown .hljs-bullet,.markdown .hljs-link_url,.smalltalk .hljs-char,.smalltalk .hljs-symbol{color:#080}.apache .hljs-sqbracket,.asciidoc .hljs-attribute,.asciidoc .hljs-link_label,.clojure .hljs-attribute,.coffeescript .hljs-property,.erlang_repl .hljs-reserved,.haml .hljs-bullet,.hljs-array,.hljs-attr_selector,.hljs-decorator,.hljs-deletion,.hljs-doctype,.hljs-envvar,.hljs-filter .hljs-argument,.hljs-important,.hljs-javadoc,.hljs-label,.hljs-localvars,.hljs-phony,.hljs-pi,.hljs-prompt,.hljs-pseudo,.hljs-shebang,.lasso .hljs-attribute,.markdown .hljs-link_label,.nginx .hljs-built_in,.ruby .hljs-string,.tex .hljs-formula,.vhdl .hljs-attribute{color:#88f}.apache .hljs-tag,.asciidoc .hljs-strong,.bash .hljs-variable,.css .hljs-tag,.hljs-built_in,.hljs-dartdoc,.hljs-id,.hljs-javadoctag,.hljs-keyword,.hljs-phpdoc,.hljs-request,.hljs-status,.hljs-title,.hljs-type,.hljs-typename,.hljs-winutils,.hljs-yardoctag,.markdown .hljs-strong,.smalltalk .hljs-class,.tex .hljs-command{font-weight:400}.asciidoc .hljs-emphasis,.markdown .hljs-emphasis{font-style:italic}.nginx .hljs-built_in{font-weight:400}.coffeescript .javascript,.javascript .xml,.lasso .markup,.tex .hljs-formula,.xml .css,.xml .hljs-cdata,.xml .javascript,.xml .vbscript{opacity:.5}.hljs,.hljs-change,.hljs-flow,.hljs-keyword,.hljs-literal,.hljs-strong,.hljs-tag,.hljs-tag .hljs-title,.hljs-winutils,.nginx .hljs-title,.tex .hljs-special{color:#fff}.hljs .hljs-constant,.hljs-code{color:#66d9ef}.hljs-class .hljs-title,.hljs-code,.hljs-header{color:#fff}.hljs-attribute,.hljs-link_label,.hljs-regexp,.hljs-symbol,.hljs-symbol .hljs-string,.hljs-value{color:#bf79db}.apache .hljs-cbracket,.apache .hljs-tag,.django .hljs-filter .hljs-argument,.django .hljs-template_tag,.django .hljs-variable,.hljs-addition,.hljs-attr_selector,.hljs-built_in,.hljs-bullet,.hljs-emphasis,.hljs-envvar,.hljs-javadoc,.hljs-link_url,.hljs-pragma,.hljs-preprocessor,.hljs-prompt,.hljs-pseudo,.hljs-stream,.hljs-string,.hljs-subst,.hljs-tag .hljs-value,.hljs-title,.hljs-type,.ruby .hljs-class .hljs-parent,.smalltalk .hljs-array,.smalltalk .hljs-class,.smalltalk .hljs-localvars,.tex .hljs-command{color:#1E824C}.apache .hljs-sqbracket,.hljs-annotation,.hljs-blockquote,.hljs-comment,.hljs-decorator,.hljs-deletion,.hljs-doctype,.hljs-horizontal_rule,.hljs-pi,.hljs-shebang,.hljs-template_comment,.smartquote,.tex .hljs-formula{color:#75715e}.apache .hljs-tag,.bash .hljs-variable,.css .hljs-id,.diff .hljs-header,.hljs-chunk,.hljs-dartdoc,.hljs-header,.hljs-keyword,.hljs-literal,.hljs-phpdoc,.hljs-request,.hljs-status,.hljs-title,.hljs-type,.hljs-winutils,.rsl .hljs-built_in,.smalltalk .hljs-class,.tex .hljs-special,.vbscript .hljs-built_in{font-weight:700}.coffeescript .javascript,.javascript .xml,.tex .hljs-formula,.xml .css,.xml .hljs-cdata,.xml .javascript,.xml .vbscript{opacity:.5}body{height:100%}.hljs{color:#C8F7C5}#pre-z{width:100%;position:fixed;top:0;height:100%;overflow-y:scroll;left:-100%;z-index:999999;-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}input.pre-z-check{display:none}label.pre-z-lbl{color:#FFF;background-color:rgba(46,204,113,.95);padding:10px 30px;position:fixed;top:10px;left:0;z-index:999999;text-align:center;cursor:pointer;-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}label.pre-z-lbl-x{color:#FFF;background-color:rgba(46,204,113,.95);padding:10px 30px;position:fixed;top:10px;left:0;z-index:9999999;-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out;cursor:pointer;opacity:0;border:3px solid #fff;border-left:0}#pre-z pre{margin:0;font-size:12px;font-family:"Lucida Sans Unicode","Lucida Grande",sans-serif;background-color:rgba(46,204,113,.95);color:#FFF;border:none;border-radius:0;padding-top:5px;height:100%}#pre-z code{background-color:transparent;height:100%}input.pre-z-check:checked~#pre-z{left:0}input.pre-z-check:checked~label.pre-z-lbl{opacity:0}input.pre-z-check:checked~label.pre-z-lbl-x{opacity:1}#pre-z p{padding:50px;text-align:center;word-break:break-all;word-wrap:break-word;line-height:1.4;font-size:14px}#pre-z p span{font-size:150%}#pre-z h1{font-size:50px;text-align:center}</style>
	<input id="pre-z-check" type="checkbox" class="pre-z-check">
	<label class="pre-z-lbl" for="pre-z-check">PRE-Z</label>
	<label class="pre-z-lbl-x" for="pre-z-check">CLOSE</label>
	<div id="pre-z">
	<pre><code class="css"><h1>PRE-Z</h1>';
    if ($prez) {
        print_r($prez);
    } else {
        echo '<p>SOMETHING WENT WRONG</p>';
    }
    echo '</code></pre></div>';
}
开发者ID:josephfusco,项目名称:prez,代码行数:25,代码来源:prez.php

示例2: getCustomFields

 /**
  * Get all of the custom fields of this object from ACF and Wordpress
  *
  * @param  bool $run Whether or not to get the custom fields
  * @param  string[] $keys Only get specific keys
  * @return $this
  */
 public function getCustomFields(bool $run = false, array $keys = null) : User
 {
     if (!$run) {
         return $this;
     }
     // If keys is set and ACF is enabled, just get the specific keys from WP
     if (!empty($keys) && function_exists('get_field')) {
         foreach ($keys as $key) {
             $this->data[$key] = get_field($key, 'user_' . $this->data['ID']);
         }
     } else {
         // Check the Wordpress-set custom fields and if they're single item arrays
         // convert them to strings
         $wordpressMeta = (array) ((array) get_userdata($this->data['ID']))['data'];
         foreach ($wordpressMeta as &$value) {
             if (is_array($value) && count($value) === 1) {
                 $value = current($value);
             }
         }
         // Get the custom fields from ACF, if ACF is enabled
         $acfMeta = [];
         if (function_exists('get_fields')) {
             $acfMeta = get_fields('user_' . $this->data['ID']);
             if (!$acfMeta) {
                 $acfMeta = [];
             }
         }
         // Merge the data together for all of the custom fields
         $this->data = array_merge($this->data, $wordpressMeta, $acfMeta);
     }
     return $this;
 }
开发者ID:ncaroyannis,项目名称:wordpress-mvc-framework,代码行数:39,代码来源:User.php

示例3: create_xml

function create_xml($table, $conn)
{
    //получаем названия столбцов
    $fields = get_fields($table, $conn);
    //получаем данные
    $data_from_table = get_data($table, $conn);
    //создаем объект документа
    $dom = new DOMDocument('1.0', 'UTF-8');
    //создаем корневой элемент по имени таблицы
    $catalog = $dom->createElement("catalog");
    $dom->appendChild($catalog);
    //создаем контейнер для обектов
    $entities = $dom->createElement("entities");
    $catalog->appendChild($entities);
    //создаем и добавляем объекты
    foreach ($data_from_table as $value) {
        $entity = $dom->createElement("entity");
        $attribute_id = $dom->createAttribute('id');
        $attribute_id->value = $value[0];
        $entity->appendChild($attribute_id);
        for ($k = 0, $i = count($fields); $k < $i; $k++) {
            $name_tag = $dom->createElement($fields[$k], $value[$k]);
            $entity->appendChild($name_tag);
        }
        $entities->appendChild($entity);
    }
    //сохраняем документ
    $dom->save("files/xml/" . $table . ".xml");
}
开发者ID:dynamofan27,项目名称:import,代码行数:29,代码来源:main.php

示例4: getCompany

function getCompany($id)
{
    $post = get_post($id);
    $acfs = get_fields($post->ID);
    $post = array_merge((array) $post, (array) $acfs);
    return $post;
}
开发者ID:paulcote,项目名称:2016.waq.paulcote.net,代码行数:7,代码来源:api-speakers.php

示例5: sponsor_box_tag

function sponsor_box_tag($atts)
{
    global $post;
    $align = $atts['align'];
    $option = get_fields('option');
    return Timber::compile('partials/content-box-sponsor.twig', array('post' => $post, 'align' => $align, 'option' => $option));
}
开发者ID:saplingdigitalltd,项目名称:thefoodrush,代码行数:7,代码来源:shortcodes.php

示例6: wp_api_encode_acf

 /**
  * Make sure that all custom fields get attached to wp-api json output
  *
  * @since    1.0.0
  */
 function wp_api_encode_acf($data, $post, $context)
 {
     if (get_fields($post['ID'])) {
         $data['meta'] = array_merge($data['meta'], get_fields($post['ID']));
     }
     return $data;
 }
开发者ID:vcualtlab,项目名称:benson,代码行数:12,代码来源:class-benson.php

示例7: add_to_context

 function add_to_context($context)
 {
     $context['main_menu'] = new TimberMenu('primary_navigation');
     $context['site'] = $this;
     $context['options'] = get_fields('option');
     return $context;
 }
开发者ID:Dedato,项目名称:pianoles-rivera,代码行数:7,代码来源:timber.php

示例8: ACF_featured_content

 public static function ACF_featured_content($post_id)
 {
     $fields = get_fields($post_id);
     $fields = self::parsed_ACF($fields);
     $content = array('image' => null, 'standfirst' => null);
     if (!isset($fields['left'])) {
         return $content;
     }
     $fields = $fields['left'];
     if (empty($fields)) {
         return $content;
     }
     foreach ($fields as $field) {
         if (empty($field)) {
             continue;
         }
         foreach ($field as $subfields) {
             foreach ($subfields as $name => $subfield) {
                 if ($name == 'vac_block_image_slider') {
                     $image = $subfield[0];
                     $content['image'] = array('id' => $image['id'], 'caption' => $image['caption'], 'alt' => $image['alt']);
                 }
                 if ($name == 'vac_block_standfirst') {
                     $content['standfirst'] = $subfield;
                 }
             }
         }
     }
     return $content;
 }
开发者ID:guimachiavelli,项目名称:vac,代码行数:30,代码来源:template.php

示例9: get_fields

 public function get_fields($data = NULL, $object = NULL, $context = NULL)
 {
     $this->format_id($object);
     if (!($data['acf'] = get_fields($this->id))) {
         $data['acf'] = array();
     }
     return apply_filters("acf_to_wp_rest_api_{$this->type}_data", $data, $object, $context);
 }
开发者ID:heldrida,项目名称:freedomnow,代码行数:8,代码来源:class-acf-to-wp-rest-api-base.php

示例10: display

 static function display($brick_id)
 {
     $BrickClass = get_post_meta($brick_id, SlidesPostType::$brick_type_key, true);
     $BrickClass::display(get_fields($brick_id));
     // echo "<pre>";
     // print_r(get_fields($brick_id));
     // echo "</pre>";
 }
开发者ID:troubletribbles,项目名称:dr_bootstrap,代码行数:8,代码来源:BrickChooser.class.php

示例11: option

function option($key = null)
{
    static $options;
    if (!isset($options)) {
        $options = get_fields('option');
    }
    return $key == null ? $options : (isset($options[$key]) ? $options[$key] : null);
}
开发者ID:lara-press,项目名称:larapress,代码行数:8,代码来源:helpers.php

示例12: d7_add_acf_to_json_api

/**
 * Makes custom fields created with Advanced Custom Fields available in the
 * WP Rest API
 * 
 * @package d7
 * @subpackage boilerplate-plugin_filters+hooks
 * 
 * @link http://wp-api.org WP JSON API documentation
 * @link http://codex.wordpress.org/Function_Reference/is_plugin_active is_plugin_active
 * @link http://www.advancedcustomfields.com/resources ACF Resources
 * @link https://wordpress.org/support/topic/custom-meta-data-2 Source for this technique
 * @internal only used as `json_prepare_post` filter
 * 
 */
function d7_add_acf_to_json_api($postaray, $postdata, $context)
{
    if (function_exists('get_fields')) {
        $custom_fields = $postdata['ID'];
        $postaray['meta']['custom_fields'] = get_fields($custom_fields);
    }
    return $postaray;
}
开发者ID:nathansh,项目名称:nathansh.com-plugin,代码行数:22,代码来源:acf.php

示例13: get_options

/**
 * Theme Options
 */
function get_options()
{
    static $options;
    if (!isset($options)) {
        $options = function_exists('get_field') ? get_fields('options') : false;
    }
    return $options;
}
开发者ID:rku4er,项目名称:gt-wp,代码行数:11,代码来源:options.php

示例14: json_api_encode_acf

function json_api_encode_acf($post)
{
    $acf = get_fields($post['ID']);
    if (isset($post)) {
        $post['acf'] = $acf;
    }
    return $post;
}
开发者ID:Benrajalu,项目名称:holidays15,代码行数:8,代码来源:functions.php

示例15: add_to_context

 function add_to_context($context)
 {
     $context['main_menu'] = new TimberMenu('primary_navigation');
     $context['site'] = $this;
     $context['display_sidebar'] = Setup\display_sidebar();
     $context['sidebar_primary'] = Timber::get_widgets('sidebar-primary');
     $context['options'] = get_fields('option');
     return $context;
 }
开发者ID:Dedato,项目名称:vosdegoeij,代码行数:9,代码来源:timber.php


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