你怎么做数组文字?我试过了:
$args2 = array (
'post_type' => 'garotas',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'cidade',
'value' => 'SL',
// 'compare' => 'LIKE'
),
array(
'key' => 'garotastop',
'value' => 1,
// 'compare' => 'LIKE'
)
),
'posts_per_page' => -1,
'orderby' => 'rand',
'order' => 'ASC',
);
$event_query2 = new WP_Query( $args2 );
// The Query
$the_query2 = new WP_Query( $args2 );
// The Loop
if ( $the_query2->have_posts() ) {
while ( $the_query2->have_posts() ) {
$the_query2->the_post();
$title = get_the_title();
$separator = "-";
$title2 = str_replace(" ", $separator, $title);
$width = 300;
$height = 700;
echo '<li class="col-md-4"><h1 class="title5 conteudoTitulo cor1 title-list"><a href="http://garotasjp.com.br/garotas/'.$title2.'">' . get_the_title() . '</a></h1>';
echo "<div class='thumbnail3'>";
$garotastop1 = get_post_meta( $post->ID,'garotastop1', true );
$imageUrl = wp_get_attachment_image_src($garotastop1, full);
echo '<a href="http://garotasjp.com.br/garotas/'.tirarAcentos($title2).'"><img class="img-responsive" width="'.$width.'" height="'.$height.'" src="'.$imageUrl[0].'"/></a>';
echo "</div>";
echo "</li>";
}
}
/* Restore original Post Data */
wp_reset_postdata();
?>
答案 0 :(得分:8)
它比你尝试的要简单得多:for x in 635 35710 653
会起作用。
将for
视为接收参数的另一个命令,并且数组总是将每个元素扩展为一个参数 - 所以只需将它传递给它就会产生与(理论上的)相同的效果更专业的数组文字。