The MU forums have moved to WordPress.org

get_last_updated => how can i get array of all latest post (4 posts)

  1. Toucouleur
    Member
    Posted 17 years ago #

    Is there a way i can retrive an array of all bog like it's done with query_posts ?

    and to sort them by date ?

    I'm nearly sure such a plugin exists but can't find it

  2. Toucouleur
    Member
    Posted 17 years ago #

    Auto reply :

    Plugin URI: http://www.itdamager.com/plugins/wpmu-sitewide-feed/

    =

    my own code :

    <div class="recent-posts">
    <h2>Recent Posts</h2>
    <?php
    $postdata = $wpmu_sitefeed->get_data("posts");
    echo '<ul>';
    foreach ($postdata as $pdata) {
    echo '<li><a href="'.$pdata->guid.'">'.$pdata->post_title.'</a>';
    // Commentaires
    echo '<br />';
    echo '<a href="'.$pdata->guid . ($pdata->comment_count > 0 ? '#comments' : '#respond') . '">'. ($pdata->comment_count > 0 ? ($pdata->comment_count > 1 ? $pdata->comment_count . ' commentaires' : '1 commentaire') : 'aucun commentaire') . '</a>';
    // Date
    echo '<br />';
    echo mysql2date('d F Y', $pdata->post_date);
    // Icone
    echo '<br />';
    echo $pdata->theme;
    // Fin
    echo '</li>';
    }
    echo '</ul>';
    ?>
    </div>

  3. kahless
    Member
    Posted 17 years ago #

    Not working for me here is what I get

    Fatal error: Call to a member function get_data() on a non-object in /path/wp-content/themes/wooster-home/sidebar.php on line 23

    So it has a problem with

    $postdata = $wpmu_sitefeed->get_data("posts");

    Thoughts?

  4. drmike
    Member
    Posted 17 years ago #

    Best bet would be to hit this thread since it appears that ITD monitors it.

About this Topic

  • Started 17 years ago by Toucouleur
  • Latest reply from drmike