【发布时间】:2016-11-20 12:18:16
【问题描述】:
我有一个代码,它返回带有一组图像的画廊编号 1。
<?php echo photo_gallery(1); ?>
但我需要使用此代码在每个帖子中使用自定义字段将数字“1”更改为数字“2”、“3”等等
<?php the_field('number'); ?>
在第一个代码中
我需要这样的东西:
<?php echo photo_gallery( <?php the_field('number'); ?> ); ?>
结果:
<?php echo photo_gallery(2); ?>
或
<?php echo photo_gallery(3); ?>
【问题讨论】:
-
请传递 the_field('images') 返回的内容,无需再次打开 php 标签,只需将 the_field('images') 存储在变量中并传入函数内部即可。 @user3369654
-
你想达到什么目的?
-
请再看问题