這是我的WordPress查詢,但不是wordpress相關的問題。這表明,有meta_key作爲extra1和meta_value爲測試職位如何結合這個php語句來獲得多個變量輸入的結果?
<?php $customkey1 = extra1; ?>
<?php $customvalue1 = test; ?>
<?php query_posts('meta_key=' . $customkey1 . '&meta_value=' . $customvalue1 . ''); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php endwhile; ?>
<?php endif; ?>
我的問題是我怎麼還顯示,有extra1
作爲metakey和test
作爲metavalue的職位,但也有extra2
職位作爲metakey和test2
作爲同一查詢中的元值。兩個或更多變量的組合。
我沒有時間回答這個問題,只是一個評論:你爲什麼要把每行? – gd1 2011-04-30 21:08:51
我很確定這是一個WordPress的特定問題,因爲query_posts是一個wordpress函數。 – 2011-04-30 21:09:27
可能是因爲它是一個與Html混合的WordPress主題文件。不過,不是說你應該那樣做。 – rzetterberg 2011-04-30 21:11:17