本文整理汇总了PHP中get_field函数的典型用法代码示例。如果您正苦于以下问题:PHP get_field函数的具体用法?PHP get_field怎么用?PHP get_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_field函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_Relationships_by_Tag
public function get_Relationships_by_Tag($tag, $_method, $_route, $_path, $_headers)
{
if (empty($tag) || !is_string($tag)) {
return new WP_Error('json_options_invalid_tag', __("Invalid options tag"), ['status' => 404]);
}
$site = $_headers['REMOTE'];
$tags = explode(',', $tag);
if ($tags) {
$tags_query['relation'] = 'OR';
foreach ($tags as $tag) {
$tags_query[] = array('key' => 'related_tags', 'value' => $tag, 'compare' => 'LIKE');
}
}
$args = array('post_type' => 'relationship', 'meta_query' => array('relation' => 'AND', array('key' => 'site_address', 'value' => $site), $tags_query));
$relationships = new WP_Query($args);
if ($relationships->have_posts()) {
// Get the Target Categories
$targets = [];
while ($relationships->have_posts()) {
$relationships->the_post();
$targets[] = get_field('target_category');
}
$targets = dedupe($targets);
$related_categories = implode(', ', $targets);
// Find Matching Relationships
$args = array('post_type' => 'relationship', 'tax_query' => array(array('taxonomy' => 'related_categories', 'terms' => $related_categories)));
$relationships = new WP_Query($args);
// Build Relationships JSON Reponse
include 'related-json-response.php';
}
wp_reset_query();
return $sites;
}
开发者ID:fullsteamlabs,项目名称:root-around,代码行数:33,代码来源:class-root-around-relationships.php
示例2: rd_after_container
function rd_after_container()
{
$post_sidebar = '';
if (is_product()) {
if (get_field('product_sidebar')) {
$post_sidebar = get_field('product_sidebar');
}
if ($post_sidebar == 'sidebar_default' || empty($post_sidebar)) {
$post_sidebar = rd_options('reedwan_woo_product_sidebar_position');
}
} elseif (is_shop()) {
$pageID = get_option('woocommerce_shop_page_id');
if (get_field('page_sidebar', $pageID)) {
$post_sidebar = get_field('page_sidebar', $pageID);
}
if ($post_sidebar == 'sidebar_default' || empty($post_sidebar)) {
$post_sidebar = rd_options('reedwan_woo_archive_sidebar_position');
}
} elseif (is_product_category() || is_product_tag()) {
$post_sidebar = rd_options('reedwan_woo_archive_sidebar_position');
} else {
$post_sidebar = 'sidebar_none';
}
echo '</div>';
if ($post_sidebar != 'sidebar_none') {
echo '<div class="sidebar grid_3">';
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('woo-sidebar')) {
}
echo '</div>';
}
echo '</div></div></div>';
}
开发者ID:devmoonshine,项目名称:development,代码行数:32,代码来源:woo_config.php
示例3: setup_read_touch_easy_seo_caps
function setup_read_touch_easy_seo_caps()
{
$roles = touch_easy_seo_touch_get_lower_roles();
$allowed_roles = get_field('allowed_roles_for_touch_seo', 'options');
// Do not allow rights modification of administrator and current role
if (isset($roles["administrator"])) {
unset($roles["administrator"]);
}
// ALWAYS ALLOW ADMINISTRATORS TO VIEW THE PLUGIN
$adminRole = get_role("administrator");
if (current_user_can("administrator") && !current_user_can("read_touch-easy-seo")) {
$adminRole->add_cap("read_touch-easy-seo");
}
if (current_user_can("administrator") && !current_user_can("read_touch-easy-seo-settings")) {
$adminRole->add_cap("read_touch-easy-seo-settings");
}
foreach ($roles as $role_name => $role_info) {
$role = get_role($role_name);
if ($allowed_roles != '' && in_array($role_name, $allowed_roles) && !$role->has_cap("read_touch-easy-seo")) {
$role->add_cap("read_touch-easy-seo");
} elseif ($allowed_roles != '' && $role->has_cap("read_touch-easy-seo") && !in_array($role_name, $allowed_roles)) {
$role->remove_cap("read_touch-easy-seo");
} elseif ($allowed_roles == '' && $role->has_cap("read_touch-easy-seo")) {
$role->remove_cap("read_touch-easy-seo");
}
}
}
开发者ID:tofubuddha,项目名称:example,代码行数:27,代码来源:touch-meta-tags.php
示例4: display_add_field
function display_add_field($recordid = 0)
{
if ($recordid) {
$content = get_field('data_content', 'content', 'fieldid', $this->field->id, 'recordid', $recordid);
$content = explode('##', $content);
} else {
$content = array();
}
$str = '<div title="' . s($this->field->description) . '">';
$str .= '<select name="field_' . $this->field->id . '[]" id="field_' . $this->field->id . '" multiple="multiple">';
foreach (explode("\n", $this->field->param1) as $option) {
$option = trim($option);
$str .= '<option value="' . s($option) . '"';
if (array_search($option, $content) !== false) {
// Selected by user.
$str .= ' selected >';
} else {
$str .= '>';
}
$str .= $option . '</option>';
}
$str .= '</select>';
$str .= '</div>';
return $str;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:25,代码来源:field.class.php
示例5: constantcontact_submit
function constantcontact_submit()
{
$form_email = $_REQUEST['constantcontact_email'];
if ($form_email) {
$cc_user = get_field('constant_contact_username', 'option');
$cc_pass = get_field('constant_contact_password', 'option');
$cc_group = get_field('constant_contact_group_name', 'option');
if (empty($cc_user) || empty($cc_pass) || empty($cc_group)) {
$message = 'Plugin Settings incomplete';
} else {
if (empty($form_email)) {
$message = 'Email address is required.';
} else {
$cc_url = 'https://api.constantcontact.com/0.1/API_AddSiteVisitor.jsp?' . 'loginName=' . rawurlencode($cc_user) . '&loginPassword=' . rawurlencode($cc_pass) . '&ea=' . rawurlencode($form_email) . '&ic=' . rawurlencode($cc_group);
$response = wp_remote_get($cc_url);
if (is_wp_error($response)) {
$message = 'Could not connect to Constant Contact';
} else {
$rsp = explode("\n", $response['body']);
if (intval($rsp[0])) {
$message = !empty($rsp[1]) ? $rsp[1] : (intval($rsp[0]) == 400 ? __('Constant Contact username/password not accepted') : __('Constant Contact error'));
} else {
$message = get_field('constant_contact_success_message', 'option');
$message = $message ? $message : "Thank you, you've been added to the list!";
$message_type = 'success';
}
}
}
}
if ($message) {
$tabby_cc_param = array('message' => $message, 'message_type' => $message_type ? $message_type : 'error');
wp_localize_script('jquery', 'tabby_cc_param', $tabby_cc_param);
}
}
}
开发者ID:slavic18,项目名称:cats,代码行数:35,代码来源:tabbysplace-constant-contact.php
示例6: get_widget_meta
public static function get_widget_meta($widget_id, $meta_key)
{
if (!self::exists() || !$meta_key || !$widget_id) {
return;
}
return get_field($meta_key, 'widget_' . $widget_id);
}
开发者ID:pkostadinov-2create,项目名称:acf-widgets-example,代码行数:7,代码来源:acf-widgets.php
示例7: insert_fb_in_head
function insert_fb_in_head()
{
global $post;
if (!is_single()) {
echo '<meta property="fb:app_id" content="964610463630306">';
echo '<meta property="og:title" content="SMS Brandname"/>';
echo '<meta property="og:type" content="website">';
echo '<meta property="og:url" content="' . home_url() . '"/>';
echo '<meta property="og:site_name" content="SMS Brandname"/>';
echo '<meta property="og:description" content="Cam kết giá dịch vụ, Tính năng hữu ích, Khác biệt và tươi mới, Tốc độ và niềm tin, Hổ trợ tuyệt vời">';
echo "";
return;
}
//
$current_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
echo '<meta property="fb:app_id" content="964610463630306">';
echo '<meta property="og:title" content="' . get_the_title() . '"/>';
echo '<meta property="og:type" content="website">';
echo '<meta property="og:url" content="' . $current_url . '"/>';
echo '<meta property="og:site_name" content="SMS Brandname"/>';
echo '<meta property="og:description" content="Cam kết giá dịch vụ, Tính năng hữu ích, Khác biệt và tươi mới, Tốc độ và niềm tin, Hổ trợ tuyệt vời">';
echo "";
if (is_single()) {
$image = get_field('image');
echo '<meta property="og:image" content="' . $image['sizes']['large'] . '"/>';
} else {
$default_image = "http://sms.viet-digital.com/wp-content/uploads/2016/03/logo-top.png";
echo '<meta property="og:image" content="' . $default_image . '"/>';
}
echo "";
}
开发者ID:localymine,项目名称:sms-brandname,代码行数:31,代码来源:my_facebook_share.php
示例8: vc_gitem_template_attribute_acf
/**
* Get ACF data
*
* @param $value
* @param $data
*
* @return string
*/
function vc_gitem_template_attribute_acf($value, $data)
{
$label = '';
/**
* @var null|Wp_Post $post ;
* @var string $data ;
*/
extract(array_merge(array('post' => null, 'data' => ''), $data));
if (strstr($data, 'field_from_group_')) {
$group_id = preg_replace('/(^field_from_group_|_labeled$)/', '', $data);
$fields = function_exists('acf_get_fields') ? acf_get_fields($group_id) : apply_filters('acf/field_group/get_fields', array(), $group_id);
$field = is_array($fields) && isset($fields[0]) ? $fields[0] : false;
if (is_array($field) && isset($field['key'])) {
$data = $field['key'] . (strstr($data, '_labeled') ? str_replace($data, '', '_labeled') : '');
}
}
if (preg_match('/_labeled$/', $data)) {
$data = preg_replace('/_labeled$/', '', $data);
$field = apply_filters('acf/load_field', array(), $data);
$label = is_array($field) ? '<span class="vc_gite-acf-label">' . $field['label'] . ':</span> ' : '';
}
if (get_field($data)) {
$value = apply_filters('vc_gitem_template_attribute_acf_value', get_field($data, $post->ID));
}
return strlen($value) > 0 ? $label . $value : '';
}
开发者ID:hikaram,项目名称:wee,代码行数:34,代码来源:grid-item-attributes.php
示例9: get_all_feature_meta
function get_all_feature_meta($posts) {
$meta_fetch_list = array (
"feature_name",
"feature_usage",
"feature_action_cost",
"flavor_text",
"feature_requirement",
"feature_text",
"trigger",
"atk_block"
);
$abilities = array();
$i = 0;
foreach ($posts as $post) {
$abilities[$i]["title"] = $post->post_title;
$abilities[$i]["id"] = $post->ID;
$abilities[$i]["data"] = array();
foreach ($meta_fetch_list as $field) {
$abilities[$i]['data'][$field] = get_field($field, $post->ID);
}
$i++;
}
return $abilities;
}
开发者ID:supahseppe,项目名称:path-of-gaming,代码行数:30,代码来源:create_monster_json.php
示例10: ecs_newpatient_module_content_filter
function ecs_newpatient_module_content_filter($content)
{
$page = get_field('option_newpatient_page', 'option');
if (is_page($page->ID)) {
ob_start();
if (get_field('option_vacation_notice', 'option')) {
?>
<div class="info">
<?php
the_field('option_vacation_notice_text', 'option');
?>
</div>
<?php
}
gravity_form_enqueue_scripts(3, true);
gravity_form(3, false, false, false, '', true, 1);
return ob_get_clean();
} else {
return $content;
}
}
开发者ID:Johnystardust,项目名称:ecs-247-bereikbaar,代码行数:25,代码来源:newpatient.php
示例11: andclose
function andclose($PID, $order_id)
{
// NEED TO ADD ORDER ARCHIVE FILTER
$archive = get_field('order_archive', $PID);
__update_post_meta($PID, 'order_archive', $value = '');
__update_post_meta($PID, 'order_count', $value = $archive);
}
开发者ID:avijitdeb,项目名称:flatterbox.com,代码行数:7,代码来源:flatterbox_action.php
示例12: __construct
function __construct()
{
$this->sitemap_url = get_field('catfish_website_url', 'option') . "sitemap-index.xml";
$this->sitemap_xml = file_get_contents($this->sitemap_url);
$this->service = new \Sabre\Xml\Service();
$this->do_mapping();
}
开发者ID:shortlist-digital,项目名称:agreable-catfish-importer-plugin,代码行数:7,代码来源:SitemapParser.php
示例13: aps_scholarship_article_month
function aps_scholarship_article_month()
{
$state = get_field('scholarship_article_journal_publication_month');
if ($state) {
echo $state . ' ';
}
}
开发者ID:gato-gordo,项目名称:association-print-scholars,代码行数:7,代码来源:scholarship_functions.php
示例14: pp_get_acf_image
/**
* Returns html for an ACF image
*
* ### Usage:
* ```php
* $image = pp_get_acf_image($image, $size, $classes);
* if ( $image ) {
* echo $image;
* }
* ```
*
* @package pp
* @subpackage boilerplate-theme
*
* @param array|string $image Image array as returned by ACF, or field name as a string
* @param string $size Image size
* @param string $classes Classes to be added
* @link http://www.advancedcustomfields.com/resources/image/
* @return string HTML output
*
*/
function pp_get_acf_image($image, $size = 'thumbnail', $classes = '')
{
// Bail early if there's no image
if (!is_array($image)) {
// Maybe it's a string with a field name?
$field = get_field($image);
if ($field) {
$image = $field;
} else {
return false;
}
}
$img = '<img src="' . $image['sizes'][$size] . '"';
// Alt
if (!empty($image['alt'])) {
$img .= ' alt="' . $image['alt'] . '"';
}
// Title
if (!empty($image['title'])) {
$img .= ' title="' . $image['title'] . '"';
}
// Classes
if ($classes) {
$img .= ' class="' . $classes . '"';
}
// width/height
$img .= ' width="' . $image['sizes'][$size . '-width'] . '"';
$img .= ' height="' . $image['sizes'][$size . '-height'] . '" />';
return $img;
}
开发者ID:nathansh,项目名称:penguinpress-theme,代码行数:51,代码来源:images.php
示例15: testimonialssingle
function testimonialssingle($att)
{
//echo '<pre>';
$posts = get_post($att['id']);
//print_r($posts);
return '<div class="testmlist"><p><i class="fa-left-quote"></i><span>' . $posts->post_content . '</span><i class="fa-right-quote"></i></p> <div class="test-details">' . get_the_post_thumbnail($posts->ID) . '</div><div class="test-name"><strong>' . $posts->post_title . '</strong> ' . get_field('position', $posts->ID) . '</div></div>';
}
开发者ID:femgineer,项目名称:website,代码行数:7,代码来源:CustomShortCode.php
示例16: csvImport
public function csvImport($post_id)
{
if (!isset($_POST['post_type']) || $_POST['post_type'] != $this->moduleSlug) {
return;
}
if (get_field('mod_table_data_type', $post_id) != 'csv') {
return;
}
ini_set('auto_detect_line_endings', true);
$file = get_field('mod_table_csv_file', $post_id);
$file = fopen($file['url'], 'r');
$data = array();
if (!$file) {
wp_die(__('There was an error opening the selected .csv-file.'));
}
while (!feof($file)) {
$row = fgetcsv($file, 0, ';');
if (count($row) === 0) {
continue;
}
foreach ($row as &$value) {
$value = mb_convert_encoding($value, 'UTF-8', 'Windows-1252');
}
array_push($data, $row);
}
fclose($file);
$data = array_filter($data);
$data = json_encode($data);
update_post_meta($post_id, 'mod_table', $data);
update_post_meta($post_id, '_mod_table', 'field_5666a2ae23643');
}
开发者ID:helsingborg-stad,项目名称:Modularity,代码行数:31,代码来源:Table.php
示例17: attforblock_add_instance
function attforblock_add_instance($attforblock)
{
/// Given an object containing all the necessary data,
/// (defined by the form in mod.html) this function
/// will create a new instance and return the id number
/// of the new instance.
$attforblock->timemodified = time();
if ($att = get_record('attforblock', 'course', $attforblock->course)) {
$modnum = get_field('modules', 'id', 'name', 'attforblock');
if (!get_record('course_modules', 'course', $attforblock->course, 'module', $modnum)) {
delete_records('attforblock', 'course', $attforblock->course);
$attforblock->id = insert_record('attforblock', $attforblock);
} else {
return false;
}
} else {
$attforblock->id = insert_record('attforblock', $attforblock);
}
//Copy statuses for new instance from defaults
if (!get_records('attendance_statuses', 'courseid', $attforblock->course)) {
$statuses = get_records('attendance_statuses', 'courseid', 0, 'id');
foreach ($statuses as $stat) {
$rec = $stat;
$rec->courseid = $attforblock->course;
insert_record('attendance_statuses', $rec);
}
}
// attforblock_grade_item_update($attforblock);
// attforblock_update_grades($attforblock);
return $attforblock->id;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:lib.php
示例18: instance_config_form
public static function instance_config_form($group, $instance = null)
{
if (isset($instance)) {
$autosubscribe = get_field('interaction_forum_instance_config', 'value', 'field', 'autosubscribe', 'forum', $instance->get('id'));
$weight = get_field('interaction_forum_instance_config', 'value', 'field', 'weight', 'forum', $instance->get('id'));
$moderators = get_column_sql('SELECT fm.user FROM {interaction_forum_moderator} fm
JOIN {usr} u ON (fm.user = u.id AND u.deleted = 0)
WHERE fm.forum = ?', array($instance->get('id')));
}
if ($instance === null) {
$exclude = '';
} else {
$exclude = 'AND i.id != ' . db_quote($instance->get('id'));
}
$existing = get_records_sql_array('
SELECT i.id, i.title, c.value AS weight
FROM {interaction_instance} i
INNER JOIN {interaction_forum_instance_config} c ON (i.id = c.forum AND c.field = \'weight\')
WHERE i.group = ?
AND i.deleted != 1
' . $exclude . '
ORDER BY c.value', array($group->id));
if ($existing) {
foreach ($existing as &$item) {
$item = (array) $item;
}
} else {
$existing = array();
}
return array('fieldset' => array('type' => 'fieldset', 'collapsible' => true, 'collapsed' => true, 'legend' => get_string('settings'), 'elements' => array('autosubscribe' => array('type' => 'select', 'title' => get_string('autosubscribeusers', 'interaction.forum'), 'options' => array(true => get_string('yes'), false => get_string('no')), 'description' => get_string('autosubscribeusersdescription', 'interaction.forum'), 'defaultvalue' => isset($autosubscribe) ? $autosubscribe : false, 'rules' => array('required' => true), 'help' => true), 'weight' => array('type' => 'weight', 'title' => get_string('Order', 'interaction.forum'), 'description' => get_string('orderdescription', 'interaction.forum'), 'defaultvalue' => isset($weight) ? $weight : count($existing), 'rules' => array('required' => true), 'existing' => $existing, 'ignore' => count($existing) == 0), 'moderator' => array('type' => 'userlist', 'title' => get_string('Moderators', 'interaction.forum'), 'description' => get_string('moderatorsdescription', 'interaction.forum'), 'defaultvalue' => isset($moderators) ? $moderators : null, 'group' => $group->id, 'includeadmins' => false, 'filter' => false, 'lefttitle' => get_string('potentialmoderators', 'interaction.forum'), 'righttitle' => get_string('currentmoderators', 'interaction.forum')))));
}
开发者ID:Br3nda,项目名称:mahara,代码行数:31,代码来源:lib.php
示例19: most_viewed
function most_viewed()
{
ob_start();
$posts = wmp_get_popular(array('limit' => 4, 'post_type' => 'paper', 'range' => 'all_time'));
global $post;
if (count($posts) > 0) {
foreach ($posts as $post) {
setup_postdata($post);
?>
<li><a href="<?php
the_permalink();
?>
">
<?php
if (get_field('short_title')) {
the_field('short_title');
} else {
the_title();
}
?>
</a></li>
<?php
}
}
wp_reset_query();
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
开发者ID:jedlovescpe2,项目名称:genesis-child-jed,代码行数:29,代码来源:most-viewed.php
示例20: render_instance
public static function render_instance(BlockInstance $instance, $editing = false)
{
$configdata = $instance->get('configdata');
$type = isset($configdata['displaytype']) ? $configdata['displaytype'] : 'texticon';
$showicon = $type == 'icononly' || $type == 'texticon' ? true : false;
$showtext = $type == 'textonly' || $type == 'texticon' ? true : false;
$owner = $instance->get('view_obj')->get('owner');
// Whether to include email button
if (isset($configdata['displayemail']) && $configdata['displayemail']) {
$email = get_field('artefact_internal_profile_email', 'email', 'principal', 1, 'owner', $owner);
} else {
$email = false;
}
if (!isset($configdata['artefactids']) || empty($configdata['artefactids'])) {
// When we first come into this block, it will have
// no social profiles configured yet.
$configdata['artefactids'] = array(0);
}
// Include selected social profiles
$sql = 'SELECT title, description, note FROM {artefact}
WHERE id IN (' . join(',', $configdata['artefactids']) . ')
AND owner = ? AND artefacttype = ?
ORDER BY description ASC';
if (!($data = get_records_sql_array($sql, array($owner, 'socialprofile')))) {
$data = array();
}
safe_require('artefact', 'internal');
$data = ArtefactTypeSocialprofile::get_profile_icons($data);
$smarty = smarty_core();
$smarty->assign('showicon', $showicon);
$smarty->assign('showtext', $showtext);
$smarty->assign('profiles', $data);
$smarty->assign('email', $email);
return $smarty->fetch('blocktype:socialprofile:content.tpl');
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:35,代码来源:lib.php
注:本文中的get_field函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论