Ciao ragazzi, ho la necessità di far visualizzare all'interno del sito web i post presenti nel blog (che è gestito tramite wordpress)
Ora utilizzo questo codice per visualizzare l'ultimo post pubblicato
Codice PHP:
<? $result_ultime_news = mysql_query("select * FROM ceramich_mvblog.wp_posts where post_status='publish' AND post_type!='nav_menu_item' ORDER BY post_date desc LIMIT 1");while ($records_ultime_news = mysql_fetch_assoc($result_ultime_news)) { $titolo_news = $records_ultime_news['post_title'];$id_news = $records_ultime_news['ID'];$riassunto_news = $records_ultime_news['post_content'];$post_name = $records_ultime_news['post_name'];?><p><a href="<?php echo "$url/blog/$post_name"; ?>.html" target="_blank" title="<?php echo "$titolo_news"; ?>"><u style="font-size:14px;"><?php echo "$titolo_news"; ?></u></a><?php echo TagliaStringa($riassunto_news, 145); ?></p>
<?}?>
Ora io vorrei far visualizzare solo i post di una determinata categoria, ho visto che posso risalire all'id della categoria stessa (esempio: 106)
Ho fatto così
Codice PHP:
<? $result_ultime_news = mysql_query("select * FROM ceramich_mvblog.wp_posts JOIN ceramich_mvblog.wp_terms where post_status='publish' AND post_type!='nav_menu_item' AND wp_terms.term_id == '106' ORDER BY post_date desc LIMIT 5");while ($records_ultime_news = mysql_fetch_assoc($result_ultime_news)) { $titolo_news = $records_ultime_news['post_title'];$id_news = $records_ultime_news['ID'];$riassunto_news = $records_ultime_news['post_content'];$post_name = $records_ultime_news['post_name'];?><li style="display:list-item;"><a href="<?php echo "$url/blog/$post_name"; ?>.html" target="_blank" title="<?php echo "$titolo_news"; ?>" style="text-decoration: none; font-size:14px;"><?php echo "$titolo_news"; ?></a></li>
<?}?>
Ma mi da questo errore
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in - See more at: http://www.mvceramiche.it/read-azien....4gW0YN20.dpuf
Consigli?