我想遍历我所有的帖子并将横幅链接放入一个数组中,例如
Array ("link1.jpg","link2.jpg","link3.jpg")
这是我的代码:
<?php
global $post;
$args = array( 'post_type' => 'banners' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<?php echo '"' .get_field('image'). '"';?>
<?php endforeach; ?>
没关系,并且 echo 正确地在列表中,但是我如何将它放入变量中?
eg. $variable = ("link1.jpg","link2.jpg","link3.jpg")