php https://www.advancedcustomfields.com/resources/flexible-content/
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php https://www.advancedcustomfields.com/resources/flexible-content/相关的知识,希望对你有一定的参考价值。
<?php
// check if the flexible content field has rows of data
if( have_rows('flexi') ):
// loop through the rows of data
while ( have_rows('flexi') ) : the_row();
// check current row layout
if( get_row_layout() == 'flex_test' ):
// repeater loop
if( have_rows('content') ):
// loop through the rows of data
echo '<div class="row">';
while ( have_rows('content') ) : the_row();
$col = get_sub_field('col');
echo '<div class="col-md-' . $col . '">';
$image = get_sub_field('image');
echo '<img src="' . $image['url'] . '" style="width:100%" alt="' . $image['alt'] . '" />';
$text = get_sub_field('text');
echo '<p>' . $text . '</p>';
echo '</div>';
endwhile;
echo '</div>';
endif;
// single echo 2 col
echo '<div class="row"><div class="col-md-12">';
the_sub_field('paragraph');
echo '</div></div>';
elseif( get_row_layout() == 'multicol' ):
// single echo 2 col
if( get_sub_field('columns') == '1' ):
echo '<div class="col-md-12">';
the_sub_field('paragraph');
echo '</div>';
elseif( get_sub_field('columns') == '2' ):
echo '<div class="col-md-6">';
the_sub_field('paragraph');
echo '</div>';
echo '<div class="col-md-6">';
the_sub_field('paragraph_2');
echo '</div>';
endif;
endif;
endwhile;
else :
// no layouts found
endif;
?>
以上是关于php https://www.advancedcustomfields.com/resources/flexible-content/的主要内容,如果未能解决你的问题,请参考以下文章
php send.php php邮件模板#php
IntelliJ IDEA 11编辑php是,支持php文件名为.php5和.php4,如何设置能让其也支持.php呢?
如何从php5升级到php7
请问php中如何调用php文件中的内容?
php [php:PHPMailer示例] php库“PHPMailer”示例。 #PHP
php基础