php 获取所有的acf flex字段。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 获取所有的acf flex字段。相关的知识,希望对你有一定的参考价值。

<?php
/**
 * Template part for displaying flexible content in page.php.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package FoodsBy
 */

?>

<?php
if ( have_rows( 'page_sections' ) ) :

	while ( have_rows( 'page_sections' ) ) : the_row();

		if ( 'content_video_banner' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'content-video-banner' );

		elseif ( 'icon_buckets' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'icon-buckets' );

		elseif ( 'icon_block' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'icon-block' );

		elseif ( 'top_tweets' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'top-tweets' );

		elseif ( 'overlapping_buckets' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'overlapping-buckets' );

		elseif ( 'download_our_app' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'download-app' );

		elseif ( 'icon_headline_banner' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'icon-headline-banner' );

		elseif ( 'icon_columns' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'icon-columns' );

		elseif ( 'stats_block' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'stats-block' );

		elseif ( 'faq_block' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'faq-block' );

		elseif ( 'cta_block' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'cta-block' );

		elseif ( 'faq_page_block' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'faq-page-block' );

		elseif ( 'scroll_to_section' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'scroll-to-section' );

		elseif ( 'submit_a_question_form' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'submit-a-question-form' );

		elseif ( 'contact_block' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'contact-block' );

		elseif ( 'one_third_blue_columns' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'one-third-blue-columns' );

		elseif ( 'sign_up_for_foodsby' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'sign-up' );

		elseif ( 'member_login' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'member-login' );

		elseif ( 'location_search' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'location-search' );

		elseif ( 'restaurant_login' === get_row_layout() ) :

			get_template_part( 'template-parts/content', 'restaurant-login' );

		endif;

	endwhile;

endif;

以上是关于php 获取所有的acf flex字段。的主要内容,如果未能解决你的问题,请参考以下文章

php ACF |从多选字段中获取所有选定的选项。

php ACF从选项页面获取字段

php 从ACF图像字段获取SVG cde

php 从单选按钮字段获取Acf Conditional H1

php 从单选按钮字段获取Acf Conditional H1

在functions.php中获取相关组的ACF字段值(通过Post Object)