首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ACF Wordpress样式自定义字段

问ACF Wordpress样式自定义字段
EN

Stack Overflow用户
提问于 2016-09-23 23:18:16
回答 1查看 275关注 0票数 0

我有一个在.php文件中设置ACF的每个字段样式的问题。

代码语言:javascript
复制
<?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字段;

例如:

代码语言:javascript
复制
                    <p class="text-faded">?php get_field('service_description');?>
                    </p>

如何以正确的方式使用html包装php (而不是用php破解php代码,然后再次中断)

EN

回答 1

Stack Overflow用户

发布于 2017-08-22 21:45:37

下面是我建议你做的:

代码语言:javascript
复制
<?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“里面的所有东西,然后你就可以样式化里面的任何东西了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39664267

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档