Visualizzazione 2 filoni di risposte
Visualizzazione 2 filoni di risposte
- Devi essere connesso per rispondere a questo topic.
Email: info@wpitaly.it
Home › Forum › Problemi Vari con WP › Query per estrarre articoli di una categoria
salve, sto provandoa c reare una query che estragga gli ultimi 2 articoli (solo il titolo) degli articoli in una determinata categoria (ID=28) dal DB di WP, agendo da un sito esterno. La query funzionava prima dell’aggiornamentoa lla 2.3 ma ora, essendo cambiata la struttura del DB devo anche risistemare la query.
Non so se ho capito come gestisce l’associazione tra post e categorie ma ho provato a fare questo, che cmq non funziona:
SELECT wp_posts.post_title FROM wp_posts, wp_term_relationships, wp_term_taxonomy WHERE wp_posts.ID = wp_term_relationships.object_id AND wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id AND
wp_term_taxonomy.taxonomy = ‘category’ AND wp_term_taxonomy.count = 28 ORDER BY post_date DESC LIMIT 2
Estrae delle cose ma non capisco con quale criterio.
Sapete aiutarmi?
Grazie in anticipo!
(NN POSSO USARE PLUGINS… STO SU UN ALTRO SITO NON IN WP)
AND wp_term_taxonomy.count = 28
prova a cambiarlo con
AND wp_terms.term_id = 28
il criterio cmq lo stabilisci tu con la query
No infatti lo so che lo stabilisco io con la query… sennò come avrei fatto a scrivere quel che ho scritto eheheh
Solo che non viene estratto quello che pensavo quindi non capisco quale altro criterio si rispetti.
Ora provo il tuo consiglio.
WPItaly - Copyright Creative Commons: CC BY-NC-SA 4.0