如何使用多於1個自定義鍵/值對從類別查詢帖子?wordpress查詢
0
A
回答
0
可以包括postmeta幾次。
$querystr = "
SELECT wposts.*
FROM $wpdb->posts wposts,
$wpdb->postmeta wpostmeta1,
$wpdb->postmeta wpostmeta2
WHERE wposts.ID = wpostmeta1.post_id
AND wposts.ID = wpostmeta2.post_id
AND wpostmeta1.meta_key = 'tag'
AND wpostmeta1.meta_value = 'email'
AND wpostmeta2.meta_key = 'anothertag'
AND wpostmeta2.meta_value = 'anothervalue'
AND wposts.post_status = 'publish'
AND wposts.post_type = 'post'
ORDER BY wposts.post_date DESC
";
$pageposts = $wpdb->get_results($querystr, OBJECT);
0
有很多信息this here
例如...
$querystr = "
SELECT wposts.*
FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
WHERE wposts.ID = wpostmeta.post_id
AND wpostmeta.meta_key = 'tag'
AND wpostmeta.meta_value = 'email'
AND wposts.post_status = 'publish'
AND wposts.post_type = 'post'
ORDER BY wposts.post_date DESC
";
$pageposts = $wpdb->get_results($querystr, OBJECT);
+0
試過 - - 它只有一個鍵/值對 – InnateDev 2010-03-19 12:45:21
1
$query = "SELECT * FROM dishes " ;
$return = $db->query($query) ;
相關問題
- 1. Wordpress mysql查詢
- 2. WordPress的查詢
- 3. PhpMyAdmin查詢WordPress
- 4. Wordpress慢查詢
- 5. Wordpress查詢
- 6. WordPress的查詢
- 7. WordPress的查詢
- 8. wordpress mysql_num_rows查詢
- 9. WordPress的 - WPDB查詢
- 10. WordPress查詢幫助
- 11. Wordpress搜索查詢
- 12. 幫助Wordpress查詢
- 13. Wordpress查詢和Get_Post_Meta
- 14. WordPress的 - SQL查詢
- 15. Paginate Wordpress $ wpdb查詢?
- 16. 優化Wordpress查詢
- 17. SQL查詢的wordpress
- 18. WordPress郵寄查詢
- 19. WordPress查詢查詢中的空數據
- 20. 在functions.php中的Wordpress查詢
- 21. WordPress查詢:ORDER BY CASE WHEN
- 22. WordPress的MySQL查詢失敗
- 23. 在wordpress中選擇查詢
- 24. WordPress的自定義查詢
- 25. 查詢WordPress的縮略圖
- 26. Wordpress查詢與分頁
- 27. Wordpress查詢運行兩次
- 28. 高級WordPress的SQL查詢
- 29. WordPress搜索框+ CMS查詢
- 30. wordpress短代碼查詢
aha!那麼這個查詢如何處理類別ID選擇? – InnateDev 2010-03-21 14:38:17