【发布时间】:2019-09-26 14:56:50
【问题描述】:
我是 ACF 的新手,想使用转发器字段来创建两列行。它按我想要的方式运行(两个偶数,减半的列)。我希望每一列都以与另一列相同的高度开始,因此我设置了高度。但是我想确保我使用的是最佳实践……我是如何按照您建议的方式编写的?我觉得可能有更好的方法。
提前谢谢你。
PHP
<div class="bg-white">
<div class="dib mw9 center">
<?php
if( have_rows('faq') ):
while ( have_rows('faq') ) : the_row(); ?>
<div class="parent">
<h4><?php the_sub_field('question'); ?></h4>
<p><?php the_sub_field('question_answer'); ?></p>
</div>
<?php endwhile;
else :
endif;
?>
</div>
</div>
CSS
.parent {
display: inline-block;
height: 240px;
width: 50%;
float: left;
padding: 48px 24px;
}
【问题讨论】:
标签: php css wordpress advanced-custom-fields