Birden taksonomilerin sorgula

0 Cevap php

Ben yerine "Taksonomisine ile İlgili Yayınlar" yapmak için (Kategori İlgili Mesajlar) eklentisi wordpress modifiye ettim. Ben bu sorguda eklemek istediğiniz birden çok taksonomilerin (elemanlar, renkler, ve ruh) yarattık, ama sadece tek bir taksonomi (elemanlar) ile çalışması için görünebilir. Aşağıdaki kodu yalnızca aynı "unsurlar" olması ilgili mesajlar verir. Ben yanlış ne yapıyorum? Ben de bir tane, iki, veya tüm taksonomilerin değil, sadece elemanları maç mesajları dönmek kod istiyorum.

$posts = $GLOBALS['wpdb']->get_results(
sprintf(
"SELECT DISTINCT object_id as ID, post_title 
FROM {$GLOBALS['wpdb']->term_relationships} r, {$GLOBALS['wpdb']->term_taxonomy} t, {$GLOBALS['wpdb']->posts} p 
WHERE t.term_id IN (SELECT t.term_id FROM {$GLOBALS['wpdb']->term_relationships} r, {$GLOBALS['wpdb']->term_taxonomy} t 
WHERE r.term_taxonomy_id = t.term_taxonomy_id 
AND t.taxonomy = 'elements' 
AND r.object_id = $id) 
AND r.term_taxonomy_id = t.term_taxonomy_id 
AND p.post_status = 'publish' 
AND p.ID = r.object_id 
AND object_id <> $id %s %s %s",
($type ? ("AND p.post_type = '" .$type. "'") : ''),
($orderby ? ('ORDER BY ' .(strtoupper($params['orderby']) == 'RAND' ? 'RAND()' : $orderby. ' ' .$order)) : ''),
($limit ? ('LIMIT ' .$limit) : '')
)

0 Cevap