我想後誰擁有自定義字段值「說唱」對自定義文本字段「音樂型」獲取後反對票特定的自定義字段值
$artists = array('posts_per_page' => 50, 'offset'=> 0, 'meta_key' => 'music-type', 'meta_value' => 'Rap', 'order'=>'ASC');
$artists_lst = get_posts($artists); foreach ($artists_lst as $post) : setup_postdata($post);
$post_id=$post->ID;
<li><a href="#"><?php echo $post_id; ?></a></li>
<?php endforeach; ?>
</ul>
您的示例代碼看起來不像格式正確。你在使用什麼CMS /博客? – Twisty
thanx回覆,即時通訊使用wordpress – Habib
$ artists = array('posts_per_page'=> 50,'offset'=> 0,'meta_key'=>'music-type','meta_value'=>'Rap','order '=>'ASC'); $ artists_lst = get_posts($ artists); foreach($ artists_lst as $ post):setup_postdata($ post); $ post_id = $ post-> ID; echo $ post_id – Habib