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

PHP get_sub_field_object函数代码示例

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

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



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

示例1: while

	
	<?php 
if (have_rows('neighbourhood')) {
    ?>
  <section class="square-group">

  	
  	<?php 
    while (have_rows('neighbourhood')) {
        the_row();
        // vars
        $name = get_sub_field('neighbourhood_name');
        $link = get_sub_field('neighbourhood_external_link');
        $image = get_sub_field('neighbourhood_image');
        $area = get_sub_field_object('neighbourhood_area');
        $type = get_sub_field_object('neighbourhood_type');
        $area_value = get_sub_field('neighbourhood_area');
        $type_value = get_sub_field('neighbourhood_type');
        $area_label = $area['choices'][$area_value];
        $type_label = $type['choices'][$type_value];
        ?>
    
    <a class="square <?php 
        echo $type_value;
        ?>
 <?php 
        echo $area_value;
        ?>
 all all--areas all--types" href="<?php 
        echo $link;
        ?>
开发者ID:SimoNonnis,项目名称:ArtistResidenceBrighton,代码行数:30,代码来源:neighbourhood.php


示例2: update_sub_field

function update_sub_field($selector, $value, $post_id = false)
{
    // filter post_id
    $post_id = acf_get_valid_post_id($post_id);
    // vars
    $field = false;
    // within a have_rows loop
    if (is_string($selector)) {
        // get current row
        $row = acf_get_row();
        // override $post_id
        $post_id = $row['post_id'];
        // get sub field
        $field = get_sub_field_object($selector, false, false);
        // create dummy field
        if (!$field) {
            $field = acf_get_valid_field(array('name' => $selector, 'key' => '', 'type' => ''));
        }
        // update name
        $field['name'] = "{$row['name']}_{$row['i']}_{$field['name']}";
    } elseif (is_array($selector)) {
        // validate
        if (count($selector) < 3) {
            return false;
        }
        // vars
        $parent_name = acf_extract_var($selector, 0);
        // load parent
        $field = acf_maybe_get_field($parent_name, $post_id);
        // add to name
        $name = "{$field['name']}";
        // sub fields
        foreach ($selector as $s) {
            if (is_numeric($s)) {
                $row_i = intval($s) - 1;
                // add to name
                $name .= "_{$row_i}";
            } else {
                // update parent
                $field = acf_get_sub_field($s, $field);
                // create dummy field
                if (!$field) {
                    $field = acf_get_valid_field(array('name' => $s, 'key' => '', 'type' => ''));
                }
                // add to name
                $name .= "_{$field['name']}";
            }
            // if
        }
        // foreach
        // update name
        $field['name'] = $name;
    }
    // delete
    if ($value === null) {
        return acf_delete_value($post_id, $field);
    }
    // update
    return acf_update_value($value, $post_id, $field);
}
开发者ID:de190909,项目名称:WPTest,代码行数:60,代码来源:api-template.php


示例3: while

<?php

$area_value = 3;
if (have_rows('selected_panels')) {
    echo '
	<section id="feature_single" class="row">
		<div class="content_wrap">
		';
    // loop through the rows of data
    while (have_rows('selected_panels')) {
        the_row();
        $panel_position = intval(get_sub_field_object('panel_display_position')['value']);
        $value = get_sub_field("new_panel");
        $ID = $value;
        $args = array('p' => $ID, 'post_type' => 'feature_panels');
        $loop = new WP_Query($args);
        // $count = $loop->post_count;
        while ($loop->have_posts()) {
            $loop->the_post();
            $have_image = 0;
            $have_headline = 0;
            $have_text = 0;
            if ($panel_position == $area_value) {
                $feature_image = get_field('feature_image');
                $feature_display_size = 'large';
                if (!empty($feature_image)) {
                    $have_image = 1;
                }
                if (get_field('feature_headline') != '') {
                    $have_headline = 1;
                }
开发者ID:joewatts000,项目名称:Enable,代码行数:31,代码来源:display_feature_pos_3.php


示例4: custom_form_display

function custom_form_display($post_id)
{
    if (have_rows('forms_type', $post_id)) {
        echo ' <form class="f-sport ac-custom ac-checkbox ac-checkmark">';
        echo '<div class="middle">';
        // loop through the rows of data
        while (have_rows('forms_type', $post_id)) {
            the_row();
            $required_text = '';
            $required_input = '';
            if (get_row_layout() == 'text_field') {
                $filed_title = get_sub_field('filed_title');
                $filed_placeholder = get_sub_field('filed_placeholder');
                $required = get_sub_field('required');
                if ($required) {
                    $required_text = '[חובה]';
                    $required_input = 'required';
                }
                ?>

                <fieldset class="row">
                    <div class="col">
                        <label for="person"><?php 
                echo $filed_title . ' ' . $required_text;
                ?>
</label>
                        <input type="text" id="person" placeholder="<?php 
                echo $filed_placeholder;
                ?>
" <?php 
                echo $required_input;
                ?>
 class="js-isEmpty">
                    </div>
                </fieldset>
<?php 
            } elseif (get_row_layout() == 'email_field') {
                $filed_title = get_sub_field('filed_title');
                $filed_placeholder = get_sub_field('filed_placeholder');
                $required = get_sub_field('required');
                if ($required) {
                    $required_text = '[חובה]';
                    $required_input = 'required';
                }
                ?>
                <fieldset class="row">
                    <div class="col">
                        <label for="email"><?php 
                echo $filed_title . ' ' . $required_text;
                ?>
</label>
                        <input type="email" id="email" <?php 
                echo $required_input;
                ?>
 class="js-isEmpty js-isEmail">
                    </div>
                </fieldset>
<?php 
            } elseif (get_row_layout() == 'date_field') {
            } elseif (get_row_layout() == 'text_area_field') {
                $filed_title = get_sub_field('filed_title');
                $filed_placeholder = get_sub_field('filed_placeholder');
                $required = get_sub_field('required');
                if ($required) {
                    $required_text = '[חובה]';
                    $required_input = 'required';
                }
                ?>
                <fieldset class="row">
                    <label for="message"><?php 
                echo $filed_title . ' ' . $required_text;
                ?>
</label>
                    <textarea rows="3" id="message"></textarea>
                </fieldset>
<?php 
            } elseif (get_row_layout() == 'image_selector_field') {
                $images = get_sub_field_object('images');
                $images = $images['value'];
                ?>
                <fieldset class="b-img-picker">
                    <div class="col-wrap">
                <?php 
                $count = 1;
                foreach ($images as $image) {
                    ?>
                    <div class="col">
                        <input type="radio" id="rd<?php 
                    echo $count;
                    ?>
" name="image">
                        <label for="rd<?php 
                    echo $count;
                    ?>
" class="radio"></label>
                        <div class="img-wrap"><img src="<?php 
                    echo $image['image_option']['url'];
                    ?>
" alt=""></div>
                    </div>
//.........这里部分代码省略.........
开发者ID:haimlati82,项目名称:hp,代码行数:101,代码来源:theme-func.php


示例5: get_sub_field

        $i++;
        ?>
      
    <?php 
        //begin image stuff
        $image = get_sub_field('gallery_image');
        $image_thumb = $image['sizes']['b-thumb'];
        $alt = $image['alt'];
        $title = $image['title'];
        ?>
      
        <a href="#gallery-<?php 
        echo $i;
        ?>
" class="gallery-item <?php 
        $fields = get_sub_field_object('gallery_category');
        $value = $fields['value'];
        $choices = $fields['choices'];
        if ($value) {
            foreach ($value as $j => $b) {
                echo $b . ' ';
            }
        }
        ?>
 open-popup-link">
          
          <div class="gallery-image-wrap"><img class="gallery-image" src="<?php 
        echo $image_thumb;
        ?>
" alt="<?php 
        echo $alt;
开发者ID:Burzmalian,项目名称:concrete-science,代码行数:31,代码来源:layout-gallery.php


示例6: get_sub_field_object

<div id="block_id<?php 
echo $firmasite_content_blocks["block_id"];
?>
" class="content_blocks contact_form_block">
    <?php 
if (!empty($header) && !(isset($firmasite_content_blocks["blocks"][$firmasite_content_blocks["parent"]]["collection_type"]) && "row" != $firmasite_content_blocks["blocks"][$firmasite_content_blocks["parent"]]["collection_type"])) {
    ?>
    <h3 class="header"><?php 
    echo $header;
    ?>
</h3>
    <?php 
}
?>
    <?php 
$field = get_sub_field_object('contact_form_inputs');
$selected_inputs = get_sub_field('contact_form_inputs');
$user = get_sub_field('who_will_get_sent_message');
if (isset($user["ID"])) {
    $userid = $user["ID"];
} else {
    $users_query = new WP_User_Query(array('role' => 'Administrator', 'orderby' => 'id'));
    $results = $users_query->get_results();
    foreach ($results as $user) {
        $userid = $user->ID;
    }
}
if (!empty($selected_inputs)) {
    ?>
        <div class="firmasite_acf_contact">
            <form name="firmasite_acf_contact_form" id="contact_me<?php 
开发者ID:bonnbonito,项目名称:adkins-theme,代码行数:31,代码来源:loop.php


示例7: get_sub_field

function get_sub_field($selector = '', $format_value = true)
{
    // get sub field
    $sub_field = get_sub_field_object($selector, $format_value);
    // bail early if no sub field
    if (!$sub_field) {
        return false;
    }
    // return
    return $sub_field['value'];
}
开发者ID:rmikeska,项目名称:ushipnetwork,代码行数:11,代码来源:api-template.php


示例8: the_sub_field

					<div class="col-xs-12 col-sm-3 name">
						<?php 
        the_sub_field('title');
        ?>
					</div>
					<div class="col-xs-12 col-sm-3 location">
						<?php 
        the_sub_field('location');
        ?>
, <?php 
        the_sub_field('city');
        ?>
					</div>	
					<div class="col-xs-12 col-sm-2 status">
						<?php 
        $field = get_sub_field_object('status');
        $value = get_sub_field('status');
        $label = $field['choices'][$value];
        echo $label;
        ?>
					</div>
					<div class="col-xs-12 col-sm-2">
						<?php 
        if (get_sub_field('status') == "sold_out") {
            ?>
    									<span class="btn btn-block btn-success" disabled="disabled"><?php 
            the_sub_field('button_text');
            ?>
</span>
    								<?php 
        } else {
开发者ID:ishankaru,项目名称:tajmer.dk,代码行数:31,代码来源:section-calendar-single.php


示例9: while

<?php

/**
 * Social Icons.
 *
 * @package Chroma_Theme
 */
if (function_exists('get_field') && have_rows('social_icons', 'option')) {
    ?>

    <ul class="social-icons">

    <?php 
    while (have_rows('social_icons', 'option')) {
        the_row();
        $soc_object = get_sub_field_object('social_icon_type');
        $soc_value = get_sub_field('social_icon_type');
        $soc_title = $soc_object['choices'][$soc_value];
        $soc_fa_class = 'fa fa-' . get_sub_field('social_icon_type');
        if (get_sub_field('social_icon_target')) {
            $soc_target = ' target="_blank"';
        }
        if (get_sub_field('social_icon_custom_class')) {
            // Custom Social Icons
            $soc_fa_class = 'fa ' . get_sub_field('social_icon_custom_class');
            $soc_title = get_sub_field('social_icon_custom_name');
        }
        ?>

			<li class="<?php 
        the_sub_field('social_icon_type');
开发者ID:chromasites,项目名称:Chroma-Theme,代码行数:31,代码来源:social-icons.php


示例10: get_template_directory_uri

echo get_template_directory_uri();
?>
/assets/img/develop.png">
        </div>
        <div id="download" class="hidden-column">
          <?php 
if (get_field('footer-content')) {
    while (has_sub_field('footer-content')) {
        ?>
          <div class="files">
            <?php 
        if (get_row_layout() == 'downloads') {
            $document = get_sub_field('pdf-document');
            $document_title = get_the_title($document);
            $document_link = wp_get_attachment_url($document);
            $document_object = get_sub_field_object('pdf-document');
            $document_size = filesize(get_attached_file($document));
            $document_size = size_format($document_size, 2);
            ?>
            <div class="file-icon">
              <a href="<?php 
            echo $document_link;
            ?>
"><span></span></a>
            </div>
            <div class="file-text"><?php 
            echo $document_size;
            ?>
</div>
          <?php 
        }
开发者ID:KareemAtif,项目名称:African-Internet-Rights,代码行数:31,代码来源:no-front-page.php


示例11: while

// check if the flexible content field has rows of data
if (have_rows('flex_content')) {
    ?>

	<?php 
    // loop through the rows of data
    while (have_rows('flex_content')) {
        the_row();
        if (get_row_layout() == 'section') {
            $title = get_sub_field('title');
            $paragraph = get_sub_field('paragraph');
            $link = get_sub_field('link');
            $should_create_on_top_container = !empty($title) || !empty($paragraph) || !empty($link);
            ?>
		<section class="section <?php 
            $section_css_class = get_sub_field_object('section_css_class');
            if (!empty($section_css_class)) {
                echo join($section_css_class['value'], ' ');
            }
            ?>
 <?php 
            echo !$should_create_on_top_container ? 'section-map' : '';
            ?>
">
			<?php 
            $background_type = get_sub_field('background_type');
            if ($background_type == 'image') {
                ?>

        <!-- Show background image -->
        <?php 
开发者ID:alessiosantocs,项目名称:wp-maison,代码行数:31,代码来源:flex-layout.php


示例12: while

}
?>
						    		</div>
						    		<div class="row">
						    			<div class="col-xs-12">
						                      <div class="colors">
												    			   	<h2>Colors avaliable</h2>				  
												    					  <?php 
if (have_rows('colors_available')) {
    // loop through the rows of data
    while (have_rows('colors_available')) {
        the_row();
        ?>
																						<?php 
        // display a sub field value
        $field = get_sub_field_object('color_name');
        $value = get_sub_field('color_name');
        $label = $field['choices'][$value];
        echo '<h3><span class="color-block" style="background: #' . $value . '"></span>' . $label . '</h3>';
        ?>
																						<?php 
    }
} else {
    // no rows found
}
?>
												  </div>
												  <div class="colors">
												    	<h2 style="margin-top: 30px;">Product Information</h2>				  
												    	<ul class="pdfdownloads">
												    		<?php 
开发者ID:nlk-sites,项目名称:rotoplas,代码行数:31,代码来源:single-productold.php


示例13: while

            }
            ?>
			</h4>
            <?php 
        }
    }
    ?>

            <?php 
    if (have_rows('author_6')) {
        while (have_rows('author_6')) {
            the_row();
            ?>
			<h4>
            <?php 
            $field = get_sub_field_object('author_types');
            $value = get_sub_field('author_types');
            $label = $field['choices'][$value];
            if (!$value == 'AT0') {
                echo $label;
            }
            ?>
			<?php 
            $posts = get_sub_field('name');
            if ($posts) {
                ?>
				<?php 
                foreach ($posts as $post) {
                    // variable must be called $post (IMPORTANT)
                    ?>
				<?php 
开发者ID:tadas8,项目名称:Kaiseisha,代码行数:31,代码来源:single-book.php


示例14: array

    $post_count++;
    echo '<!--' . $post_count . '-->';
    ?>

					<?php 
    $outs = array();
    if (have_rows('owyl')) {
        ?>
					<?php 
        while (have_rows('owyl')) {
            the_row();
            ob_start();
            if (get_sub_field('associated_shops') || get_sub_field('category') != 'none') {
                $title = get_sub_field('title');
                $brand = get_sub_field('brand');
                $field = get_sub_field_object('field_name');
                $price = get_sub_field('price');
                $image = get_sub_field('image');
                $link = get_sub_field('link');
                // $isFeatured  = get_sub_field('featured_product');
                $isSale = get_sub_field('on_sale');
                $catTest = get_sub_field('category');
                $label = $field['choices'][$catTest];
                //$curated  = get_sub_field('curated_shops');
                $curated_shops = get_sub_field('associated_shops');
                if ($curated_shops) {
                    $shops = array();
                    foreach ($curated_shops as $shop) {
                        $shops[] = $shop->slug;
                    }
                    $shops = implode(" ", $shops);
开发者ID:developmentDM2,项目名称:The-Haute-Mess,代码行数:31,代码来源:category-shop.php


示例15: while



		<?php 
//display multiple features panels if they exist
$haveTwoColumnFeature = 0;
$columnClass = 'col-xs-12 col-sm-4 feature_wrap';
if (have_rows('features')) {
    echo '
				<section id="feature_multi" class="row">
					<div class="content_wrap clearfix">
					';
    // loop through the rows of data
    while (have_rows('features')) {
        the_row();
        //print_r(get_sub_field_object('use_two_columns'));
        $num_of_cols = intval(get_sub_field_object('use_two_columns')['value']);
        if ($haveTwoColumnFeature == 0 && $num_of_cols == 1) {
            $haveTwoColumnFeature = 1;
            $columnClass = 'col-xs-12 col-sm-8 feature_wrap';
        } else {
            $columnClass = 'col-xs-12 col-sm-4 feature_wrap';
        }
        // display a sub field value
        echo '
						<div class="single_feature ' . $columnClass . '">
							<div class="feature-inner clearfix">
							';
        // display feature text
        if ($num_of_cols == 1) {
            echo '<div class="col-xs-12 col-sm-6">';
        }
开发者ID:joewatts000,项目名称:Enable,代码行数:29,代码来源:template-main-page.php


示例16: psp_update_sub_field

function psp_update_sub_field($selector, $value, $post_id = false)
{
    // filter post_id
    // $post_id = acf_get_valid_post_id( $post_id );
    // vars
    $field = false;
    $name = '';
    // within a have_rows loop
    if (is_string($selector)) {
        // loop over global data
        if (!empty($GLOBALS['acf_field'])) {
            foreach ($GLOBALS['acf_field'] as $row) {
                // add to name
                $name .= "{$row['name']}_{$row['i']}_";
                // override $post_id
                $post_id = $row['post_id'];
            }
        }
        // get sub field
        $field = get_sub_field_object($selector);
        // create dummy field
        if (!$field) {
            $field = acf_get_valid_field(array('name' => $selector, 'key' => '', 'type' => ''));
        }
        // append name
        $name .= $field['name'];
        // update name
        $field['name'] = $name;
    } elseif (is_array($selector)) {
        // validate
        if (count($selector) < 3) {
            return false;
        }
        // vars
        $parent_name = acf_extract_var($selector, 0);
        // load parent
        $field = get_field_object($parent_name, $post_id, false, false);
        // add to name
        $name .= "{$field['name']}";
        // sub fields
        foreach ($selector as $s) {
            if (is_numeric($s)) {
                $row_i = intval($s) - 1;
                // add to name
                $name .= "_{$row_i}";
            } else {
                // update parent
                $field = acf_get_sub_field($s, $field);
                // create dummy field
                if (!$field) {
                    $field = acf_get_valid_field(array('name' => $s, 'key' => '', 'type' => ''));
                }
                // add to name
                $name .= "_{$field['name']}";
            }
            // if
        }
        // foreach
        // update name
        $field['name'] = $name;
    }
    // save
    return acf_update_value($value, $post_id, $field);
}
开发者ID:VLabsInc,项目名称:WordPressPlatforms,代码行数:64,代码来源:transition.php


示例17: the_title



    <section id="features-wrap" class="module">
        <div class="container">
            <div class="container-inner">
                <h2><?php 
the_title();
?>
 Features</h2>

                    <?php 
$cats = array();
if (have_rows('model_features')) {
    while (have_rows('model_features')) {
        the_row();
        $obj = get_sub_field_object('model_feature_type');
        // finding array of field details
        $obj = $obj['choices'];
        // refining array
        $types = get_sub_field('model_feature_type');
        if ($types) {
            foreach ($types as $type) {
                if (!in_array($type, $cats)) {
                    $cats[$type] = $obj[$type];
                    // making an array based on the $obj variable
                }
            }
        }
    }
} else {
}
开发者ID:jackrabbit-design,项目名称:jrd-southport,代码行数:29,代码来源:single-model.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_sub_record函数代码示例发布时间:2022-05-15
下一篇:
PHP get_sub_field函数代码示例发布时间: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