wordpress the_field()路径包括数组

时间:2016-08-18 03:47:51

标签: php arrays wordpress post path

嘿伙计我是wordpress开发的新手,我遇到的问题是我使用高级自定义字段上传到wordpress帖子的文件返回的路径似乎是在路径中输出一个数组。我的代码如下,请尽可能帮忙。我面前的一切都没有了,所以我会经常登记。

这是我得到的文件路径:217,des-desk-icon ,,, image / png,http://localhost:8888/Wordpress%20development/wp-content/uploads/2016/08/des-desk-icon.png,279,279,Array

<?php while ( have_posts() ) : the_post(); ?>
                <h1><?php the_field('title'); ?></h1>
                <p><?php the_field('description'); ?></p>

                <?php if(get_field('column_description')): ?>
                    <div class="column_1">
                        <div class="column_1_image">
                        <img src="<?php the_field('column_1_image'); ?>"/>  
                        </div>
                        <div class="column_1_description">
                        <p><?php the_field('column_description'); ?></p>
                        </div>
                    </div>
                <?php endif; ?>
                <?php if(get_field('column_2_description')): ?>
                    <div class="column_2">
                        <div class="column_2_image">
                            <img src="<?php the_field('column_2_image'); ?>"/>
                        </div>
                        <div class="column_2_description">
                            <p><?php the_field('column_2_description'); ?></p>
                        </div>
                    </div>
                <?php endif; ?>
            <?php endwhile;?>

1 个答案:

答案 0 :(得分:0)

尝试一下代码,它就可以了。

  

ACF会将图像作为数组格式返回,您必须使用get_field()并使用数组格式打印它。

viewScope.put( getClientId( 'wrapper' ), 'someValue' )