• User Attivo

    Estrarre post fuori da wordpress

    Ciao ragazzi, devo estrarre i titoli dei post fuori wordpress (praticamente creare un piccolo angolo news sul sito)

    Ho fatto questo codice

    [PHP]<?php

    $id_categoria="$idWordpress";$now=gmdate("Y-m-d H:i:s",(time()+(3600)));
    $query="SELECT ceramiche_mvblog.wp_posts.* FROM ceramiche_mvblog.wp_posts, ceramiche_mvblog.wp_term_relationships, ceramiche_mvblog.wp_term_taxonomy, ceramiche_mvblog.wp_terms WHERE";$query.=" wp_posts.ID=wp_term_relationships.object_id";$query.=" AND wp_term_relationships.term_taxonomy_id=wp_term_taxonomy.term_taxonomy_id";$query.=" AND wp_term_taxonomy.taxonomy='category'";$query.=" AND wp_terms.term_id=".$id_categoria;

    $query.=" AND wp_posts.post_type='post'";$query.=" AND wp_posts.post_status = 'publish' ";$query.=" AND wp_posts.post_password =''";
    $query.=" ORDER BY wp_posts.ID LIMIT 5";
    $result_news_categoria = mysql_query("$query");while ($records_news_categoria = mysql_fetch_assoc($result_news_categoria)) { $titolo_news_categoria = $records_news_categoria['post_title'];$id_news_categoria = $records_news_categoria['ID'];$riassunto_news_categoria = $records_news_categoria['post_content'];$post_news_categoria = $records_news_categoria['post_name'];?><li style="min-height:70px;"><a href="<?php echo "$url/blog/$post_news_categoria"; ?>.html" target="_blank" title="<?php echo "$titolo_news_categoria"; ?>"><u style="font-size:14px;"><?php echo "$titolo_news_categoria"; ?></u></a><br /><?php echo TagliaStringa($riassunto_news_categoria, 200); ?></li>
    <?}?>
    </ul>
    </div>
    <?php}?>[/PHP]

    Unica pecca mi stampa 3 volte lo stesso post e non capisco come mai

    Grazie