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 esportazione articoli di una categoria
Ciao a tutti,
ho cercato e provato ma non ci riesco proprio!
ho la necessità di creare una riga che mi scorra in orizzontale con i titoli degli articoli di una certa categoria con annesso link!
Con la query creata non mi estrapola tutti gli articoli ma solamente uno oppure tutti indistintamente, sbaglio sicuramente il campo da controllare all’interno della query!
questo è quanto ho scritto:
<div>
<marquee direction="left" height="20" width="1000" onmouseover="this.stop()" onmouseout="this.start()" scrollamount="2">
<?php
$db= @mysql_connect('xxxxxx','yyyyy','zzzz');
mysql_select_db('xxxxxx' , $db);
$result = mysql_query("SELECT ID,post_title,DATE_FORMAT(post_date, '%d/%m/%y %H:%i') AS data FROM wp_posts, wp_term_relationships WHERE post_type ='post' AND post_status='publish' AND term_taxonomy_id = '4' ORDER BY post_date DESC LIMIT 0,2" ,$db);
while ($records = mysql_fetch_assoc($result)) {
echo "<a href=http://www.abcabc.it/html/?p=$records[ID] target='_self'>$records[post_title]</a> - ";
}
mysql_close($db);
?>
</marquee>
</div>
grazie!
Caso A) sei in WP, usare le funzioni di WP no? si fa in due righe due di codice
Caso Non sei in WP è un banale problema di SQL e PHP al massimo che ha a che fare con WP se non che leggi un suo DB? Qui http://codex.wordpress.org/Database_Description la descrizione delle tabelle WP e loro relazioni che dovrebbero bastare a chiarire i dubbi su come fare le join etc
Ciao Steve,
ok, grazie mille!
WPItaly - Copyright Creative Commons: CC BY-NC-SA 4.0