• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_sub_field函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: page_testimonials

function page_testimonials()
{
    ?>

	<div class="container-fluid section-spacing background-color-dark-blue">

		<div class="container wrap">

			<div class="row">

				<?php 
    if (have_rows('reviews')) {
        while (have_rows('reviews')) {
            the_row();
            // Testimonial
            $review = get_sub_field('review');
            $author = get_sub_field('author');
            $content_out = sprintf('
			        		<blockquote class="text-italic col-md-8 col-md-offset-2">
										<div class="quote-content"><p>“%s”</p></div>
										<div class="quote-author text-left">%s</div>
									</blockquote>', $review, $author);
            echo $content_out;
        }
    }
    ?>

			</div>

		</div>

	</div>

	<?php 
}
开发者ID:finestpixels,项目名称:riverplace2016,代码行数:35,代码来源:page-testimonials.php


示例2: __construct

 function __construct()
 {
     if (get_sub_field('wrap') != null) {
         $this->wrap = get_sub_field('wrap');
     }
     $i = 0;
     if (have_rows('tours')) {
         while (have_rows('tours')) {
             the_row();
             if (get_sub_field('title') != null) {
                 $this->tours[$i]['title'] = get_sub_field('title');
             }
             if (get_sub_field('description') != null) {
                 $this->tours[$i]['description'] = get_sub_field('description');
             }
             if (get_sub_field('price') != null) {
                 $this->tours[$i]['price'] = get_sub_field('price');
             }
             if (get_sub_field('duration') != null) {
                 $this->tours[$i]['duration'] = get_sub_field('duration');
             }
             if (get_sub_field('link_button') != null) {
                 $this->tours[$i]['link_button'] = get_sub_field('link_button');
             }
             $i++;
         }
     }
 }
开发者ID:AnthonyLevillon,项目名称:mello_tourdescription,代码行数:28,代码来源:tourdescription.php


示例3: aiganebraska_acf_flexible_content_layout_title

function aiganebraska_acf_flexible_content_layout_title($title, $field, $layout, $i)
{
    $title = '';
    // load sub field image
    // note you may need to add extra CSS to the page t style these elements
    $color = get_sub_field('background_color');
    $title .= '<div class="thumbnail" style="display: inline-block; margin: 0 6px 0 10px; background-color:' . $color . '">';
    if ($image = get_sub_field('background_image')) {
        $image = wp_get_attachment_image_src($image, 'default-png');
        $title .= '<img src="' . $image[0] . '" height="36px" style="display: inline-block; margin-top: -28px; position: relative; top: 7px;" />';
    } else {
        if ($image = get_sub_field('hero_image')) {
            $image = wp_get_attachment_image_src($image, 'default-png');
            $title .= '<img src="' . $image[0] . '" height="36px" style="display: inline-block; margin-top: -28px; position: relative; top: 7px;" />';
        } else {
            $title .= '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAQAAAAziH6sAAAADklEQVR42mNkYGBkYAAAAA8AA7qm8EcAAAAASUVORK5CYII=" height="36px" style="display: inline-block; margin-top: -28px; position: relative; top: 7px;" />';
        }
    }
    $title .= '</div>';
    // load text sub field
    if ($text = get_sub_field('section_name')) {
        $title .= '<h4 style="display: inline-block; margin: 0 6px;">' . $text . ' - <small style="opacity: 0.65">' . $layout['label'] . '</small></h4>';
    } else {
        $title .= '<h4 style="display: inline-block; margin: 0 6px;"><small style="opacity: 0.65">' . $layout['label'] . '</small></h4>';
    }
    // return
    return $title;
}
开发者ID:aiganebraska,项目名称:The-Show,代码行数:28,代码来源:conf_prettify_acf.php


示例4: build_scoreset

 public function build_scoreset()
 {
     $this->elp_content = '<section class="elp-content">';
     foreach ($this->elp_categories as $category) {
         //we'll need these strings to call fields from within loops
         $field_base_name = strtolower(preg_replace('/\\s+/', '', $category));
         $repeater_field_title = $field_base_name . '_scores';
         $score_field_title = $field_base_name . '_score';
         $note_field_title = $field_base_name . '_score_additional_text_and_images';
         $date_field_title = $field_base_name . '_score_date';
         //catgory heading for each category
         $this->elp_content .= '<div class="elp-category cat-' . $field_base_name . '">';
         $this->elp_content .= '<h3>' . $category . '</h3>';
         //for each repeater row, three fields
         while (have_rows($repeater_field_title)) {
             the_row();
             if (get_sub_field('show_on_front') == true) {
                 $this->elp_content .= '<div class="elp-date elp-' . $field_base_name . '">' . get_sub_field($date_field_title) . '</div>';
                 $this->elp_content .= '<div class="elp-score elp-' . $field_base_name . '">' . get_sub_field($score_field_title) . '</div>';
                 $this->elp_content .= '<div class="elp-score-notes elp-' . $field_base_name . '">' . get_sub_field($note_field_title) . '</div>';
             }
         }
         //end repeater instance(s)
         $this->elp_content .= '</div>';
     }
     $this->elp_content .= '</section>';
 }
开发者ID:bacalj,项目名称:wp-european-language-assessment,代码行数:27,代码来源:elp_class.php


示例5: render

 public function render()
 {
     if (have_rows('carousel_items')) {
         //acf
         $otpt = '<div class="featured-carousel carousel cf">';
         while (have_rows('carousel_items')) {
             the_row();
             $item_image = get_sub_field('item_image');
             $description = get_sub_field('above_line');
             $link_to = get_sub_field('link_to');
             $button_text = get_sub_field('below_line');
             $otpt .= '<div class="carousel-item">';
             $imgDir = '\\Library\\php\\picture';
             $imgObj = new $imgDir();
             $imgObj->add_images_array(array($item_image['sizes']['full'], $item_image['sizes']['desktop'], $item_image['sizes']['tablet'], $item_image['sizes']['mobile']));
             $imgObj->setClass('carousel-image');
             $otpt .= $imgObj->templateBackground();
             $otpt .= '<div class="carousel-text">';
             $otpt .= '<a class="block " href="' . $link_to . '"><div class="carousel-description carousel-underline f-size-big">' . $description . '</div>';
             $otpt .= '<div class="carousel-description f-size-big">' . $button_text . '</div></a>';
             $otpt .= '</div>';
             $otpt .= '</div>';
         }
         $otpt .= '</div>';
     } else {
         $otpt = 'repeat has no rows';
     }
     return $otpt;
 }
开发者ID:AnthonyLevillon,项目名称:mello_carousel,代码行数:29,代码来源:carousel.php


示例6: acfmod_modules_image

function acfmod_modules_image()
{
    $source = get_sub_field('source');
    $alignment = get_sub_field('alignment');
    $max_width = get_sub_field('max_width');
    $thumb_size = get_sub_field('thumb_size');
    $link = bdmod_get_the_link();
    $caption = get_sub_field('caption');
    $src = $thumb_size && $thumb_size != '__full__' && isset($source['sizes'][$thumb_size]) ? $source['sizes'][$thumb_size] : $source['url'];
    $output = '';
    if ($link) {
        $output .= '<a href="' . $link . '" class="image-wrap">';
    } else {
        $output .= '<span class="image-wrap">';
    }
    $style = $max_width ? ' style="max-width:' . $max_width . '%;"' : '';
    $output .= '<img src="' . $src . '" class="align' . $alignment . '"' . $style . ' />';
    if ($caption) {
        $output .= '<span class="image-caption">' . $caption . '</span>';
    }
    if ($link) {
        $output .= '</a>';
    } else {
        $output .= '</span>';
    }
    return $output;
}
开发者ID:mmjaeger,项目名称:acf-modules,代码行数:27,代码来源:image.php


示例7: __construct

 function __construct($image = null, $caption = '', $title = '', $subtitle = '', $parallax = false)
 {
     parent::__construct();
     if (get_sub_field('image') != null) {
         $this->image = get_sub_field('image');
     } else {
         $this->image = $image;
     }
     if (get_sub_field('caption') != null) {
         $this->caption = get_sub_field('caption');
     } else {
         $this->caption = $caption;
     }
     if (get_sub_field('title_image') != null) {
         $this->title = get_sub_field('title_image');
     } else {
         $this->title = $title;
     }
     if (get_sub_field('subtitle_image') != null) {
         $this->subtitle = get_sub_field('subtitle_image');
     } else {
         $this->subtitle = $subtitle;
     }
     if (get_sub_field('parallax') != null) {
         $this->parallax = get_sub_field('parallax');
     } else {
         $this->parallax = $parallax;
     }
 }
开发者ID:AnthonyLevillon,项目名称:mello_image,代码行数:29,代码来源:Image.php


示例8: sitesettings_get_header_css

function sitesettings_get_header_css($id)
{
    $shortlinks = get_field('sitesetting-header-shortlinks', $id);
    if (!$shortlinks || $shortlinks == '') {
        return '';
    }
    $css = '';
    $i = 1;
    while (has_sub_fields('sitesetting-header-shortlinks', $id)) {
        if (get_sub_field('sitesetting-header-shortlink-appearance')) {
            $bg_color = get_sub_field('sitesetting-header-shortlink-bgcolor');
            $bg_color_hover = get_sub_field('sitesetting-header-shortlink-bgcolor-hover');
            $text_color = get_sub_field('sitesetting-header-shortlink-color');
            $text_color_hover = get_sub_field('sitesetting-header-shortlink-color-hover');
            $css .= <<<CSS
#link{$i}.top-menu-link {
    background: {$bg_color};
    color: {$text_color};
}
a#link{$i}.top-menu-link:hover {
    background: {$bg_color_hover};
    color: {$text_color_hover};
}
CSS;
        }
        $i++;
    }
    return $css;
}
开发者ID:sebjon-bytbil,项目名称:BB.CMS,代码行数:29,代码来源:header.php


示例9: ss_include_slick_carousel

function ss_include_slick_carousel()
{
    if (have_rows('slick_carousel_slider')) {
        // repeater field: Slick Carousel Repeater
        echo '<div class="wrap carousel-slider">';
        echo '<div id="slider" class="carousel responsive-carousel">';
        while (have_rows('slick_carousel_slider')) {
            the_row();
            // loop through the repeater field
            $image = get_sub_field('image');
            // get image from repeater
            echo '<div>';
            echo '<a rel="lightbox" class="fancybox-ss" href="';
            echo $image['url'];
            echo '"><img src="';
            echo $image['url'];
            echo '" alt="" /></a>';
            echo '</div>';
        }
        // end loop
        echo '</div>';
        echo '</div>';
    }
    // End Carousel repeater
}
开发者ID:Shelob9,项目名称:slick-slider-genesis-wordpress,代码行数:25,代码来源:carousel-slider.php


示例10: acfmod_open_section

function acfmod_open_section($content = '')
{
    wp_enqueue_style('acfmod-sections');
    global $acfmod_sections, $acfmod_current_section;
    $class = get_sub_field('section_class');
    if (!is_array($class)) {
        $class = $class ? array($class) : array();
    }
    if ($custom_class = get_sub_field('custom_class')) {
        $class[] = $custom_class;
    }
    if (count($class)) {
        $class = ' ' . implode(' ', $class);
    } else {
        $class = '';
    }
    $section = new ACFMOD_Section();
    $section->set_class($class);
    for ($i = 1; $i <= 4; $i++) {
        $section->set_col_width($i, get_sub_field('col_' . $i));
    }
    // append the content
    $content .= $section->open();
    // instantiate current section, or increase by one
    if (!$acfmod_current_section && $acfmod_current_section !== 0) {
        $acfmod_current_section = 0;
    } else {
        $acfmod_current_section++;
    }
    // hard code the index to avoid potential issues.
    $acfmod_sections[$acfmod_current_section] = $section;
    return $content;
}
开发者ID:mmjaeger,项目名称:acf-modules,代码行数:33,代码来源:sections.php


示例11: homeSliders

    function homeSliders($name = '', $id = 0, $w = '1600', $h = '440')
    {
        $html = '<link rel="stylesheet" type="text/css" href="' . get_bloginfo("template_directory") . '/assets/css/flexslider.css" media="screen" />
		<div class=" nopad" id="home-flexslider-wrapper">
		<div class="flexslider" style="margin:0 auto;">
		<ul class="slides">';
        if (get_field($name, $id)) {
            while (has_sub_field($name, $id)) {
                $img = get_template_directory_uri() . '/tmb.php?src=' . get_sub_field('image', $id) . '&amp;w=' . $w . '&h=' . $h . '&amp;q=90';
                $html .= '<li ><img src="' . $img . '" / >
			  <div class="flex-caption">
			  <div>
			  <h3>' . get_sub_field('title', $id) . '</h3>
			  </div>
			  </div>
			  </li>';
            }
            $html .= '</ul>
			<div class="clear"></div>
			</div>
			</div>
			<script type="text/javascript">
			jQuery(document).ready(function($){
			
			jQuery(\'.flexslider\').flexslider({
			animation: "fade",
			pauseOnHover: true,
			start: function(slider){}
			});
			
			});
			</script>';
        }
        return $html;
    }
开发者ID:djmacguyver,项目名称:cosmic-wordpress-tools,代码行数:35,代码来源:cosmic-home-slider.php


示例12: _get_sub_field

/**
 * Get a sub field of a Repeater field
 * @param str $key The meta key
 * @param mixed $default Value to return if there's no value for the custom field $key
 * @return mixed
 * @uses get_sub_field()
 */
function _get_sub_field($key, $default = '')
{
    if (function_exists('get_sub_field') && get_sub_field($key)) {
        return get_sub_field($key);
    } else {
        return $default;
    }
}
开发者ID:chromasites,项目名称:Chroma-Theme,代码行数:15,代码来源:acf-wrapper-functions.php


示例13: getAlternateLanguages

 private function getAlternateLanguages()
 {
     if (have_rows('quan_meta_hreflang')) {
         while (have_rows('quan_meta_hreflang')) {
             the_row();
             echo sprintf('<link rel="alternate" href="%s" hreflang="%s" />', get_permalink(get_sub_field('quan_meta_hreflang_url')), get_sub_field('quan_meta_hreflang_code'));
         }
     }
 }
开发者ID:alpipego,项目名称:wp-quan-postmeta,代码行数:9,代码来源:Plugin.php


示例14: get_sub_field_brick_class_name

 /**
  * @return string
  */
 public static function get_sub_field_brick_class_name()
 {
     $row_layout = get_row_layout();
     $class_name = get_sub_field($row_layout . '_brick_class');
     if (is_null($class_name)) {
         die('get_sub_field_brick_instance() could not find a hidden field named ' . $row_layout . '_brick_class .');
     }
     return $class_name;
 }
开发者ID:folbert,项目名称:fewbricks,代码行数:12,代码来源:flexible-content.php


示例15: __construct

 function __construct()
 {
     $this->wrap = get_sub_field('wrap');
     $this->size_mobile = get_sub_field('size_mobile');
     $this->size_tablet = get_sub_field('size_tablet');
     $this->size_desktop = get_sub_field('size_desktop');
     if (get_sub_field('contents') != null && get_sub_field('contents') != false && get_sub_field('contents') != true) {
         $this->contents = get_sub_field('contents');
     }
 }
开发者ID:AnthonyLevillon,项目名称:mello_grid,代码行数:10,代码来源:Grid.php


示例16: tool_acf_get_sub_fields

function tool_acf_get_sub_fields($p = array())
{
    $return = false;
    if (count($p) > 0) {
        foreach ($p as $key) {
            $return[$key] = get_sub_field($key);
        }
    }
    return $return;
}
开发者ID:kikinangulo,项目名称:wordpress-toolset,代码行数:10,代码来源:index.php


示例17: try_get_acf_image_src

/**
 * Retrieves the url of an image uploaded via an ACF image field
 * TODO: Add support for return types other than array
 *
 * @param (string) $name The name of the ACF field - assume default return of image array is used
 * @param (string) $size The size of the image to be retrieved
 * @return (string) The image url ( defaults to original size )
 */
function try_get_acf_image_src($name, $size = 'thumbnail')
{
    // Return false if ACF is not active
    if (!function_exists('get_field')) {
        return false;
    }
    // Assume default of image array is used
    $image_array = acf_get_row() ? get_sub_field($name) : get_field($name);
    return try_get_image_src_from_array($image_array, $size);
}
开发者ID:taeo920,项目名称:try-theme,代码行数:18,代码来源:try-misc-functions.php


示例18: image_bg

function image_bg($field_name)
{
    global $post;
    $image = get_sub_field($field_name);
    if ($image) {
        if (is_array($image)) {
            $image = $image['url'];
        }
        echo "background-image: url({$image});";
    }
}
开发者ID:rdourado,项目名称:atins.me,代码行数:11,代码来源:functions.php


示例19: get_page_builder_field

 function get_page_builder_field($field_key)
 {
     $uid = uniqid(true);
     $len = strlen($uid);
     $field_id = 'acfpbf_' . substr($uid, $len - 6, 6);
     $output = '<div id="acf_page_builder_field_id_' . $field_id . '" >';
     $panels_data = get_sub_field($field_key);
     $output .= $this->acf_siteorigin_panels_render($field_id, $panels_data);
     $output .= '</div>';
     return $output;
 }
开发者ID:moelleer,项目名称:ACF-Page-Builder-Field,代码行数:11,代码来源:acf-page_builder_field.php


示例20: ct_element_classes

/**
 * Set classes for a title element. These can be overridden or added to with a filter like the following:
 *     add_filter( 'ct_set_element_classes', 'custom_element_classes' );
 *     function custom_element_classes($classes) {
 *         if(is_page_template('template-landing-page.php') {
 *             $classes[]   = 'on-landing-page';
 *         }
 *         return $classes;
 *     }
 *         
 * @return string string of classes
 */
function ct_element_classes()
{
    $class_basename = 'complex-title-element';
    $classes = array();
    $classes[] = $class_basename;
    $classes[] = get_sub_field('alignment') ? ' ' . $class_basename . '-alignment-' . get_sub_field('alignment') : '';
    $classes[] = get_sub_field('emphasize') ? ' ' . $class_basename . '-emphasize' : '';
    $classes[] = get_sub_field('size') ? ' ' . $class_basename . '-size-' . get_sub_field('size') : '';
    $classes = array_filter(array_map('trim', $classes));
    echo trim(implode(' ', apply_filters('ct_set_element_classes', $classes)));
}
开发者ID:mwdelaney,项目名称:acf-complex-titles,代码行数:23,代码来源:acf-complex-titles.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_sub_field_object函数代码示例发布时间:2022-05-15
下一篇:
PHP get_stylesheets函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap