我有一个在.php文件中设置ACF的每个字段样式的问题。
<?php the_field('service_section_title'); ?>
<?php the_field('service_section_description'); ?>
<a href="<?php the_field('service_section_button_link'); ?>">Learn more</a>
<?php if( have_rows('services') ):
while ( have_rows('services') ) : the_row();
$image = get_field('service_icon'); if( !empty($image) ):
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
get_field('service_title');
get_field('service_description');
endwhile; else : endif; ?>我应该如何准确地将HTML放在包装我的
get_field('service_title');
get_field('service_description');
和Image字段;
例如:
<p class="text-faded">?php get_field('service_description');?>
</p>如何以正确的方式使用html包装php (而不是用php破解php代码,然后再次中断)
发布于 2017-08-22 21:45:37
下面是我建议你做的:
<?php if (have_rows('repeater')): ?>
<?php while (have_rows('repeater')): the_row(); ?>
<?php
$variable = get_sub_field('variable');
?>
<div class="repeater-item">
<div class="variable-item">
<?php echo $variable; ?>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>之后你要做的就是样式化div class="variable-item“里面的所有东西,然后你就可以样式化里面的任何东西了。
https://stackoverflow.com/questions/39664267
复制相似问题