• Hi there, I’ve spotted this nice site https://www.finisterreuk.com/newsletters/ which uses wordpress, I want to emulate the little latest posts window at the top left, what is the easiest way to pull a list of say 5 recent posts from wordpress onto a static page with links?

    Hope somebody can help, I’m currently trying this

    <?php
    $how_many=5; //How many posts do you want to show
    require_once(‘wp-config.php’); // Change this for your path to wp-config.php file ?>

    <ul class=”whats-new”>
    <?php
    $news=$wpdb->get_results(“SELECT ID,post_title FROM $wpdb->posts
    WHERE post_type=\”post\” AND post_status= \”publish\” ORDER BY post_date DESC LIMIT $how_many”);
    foreach($news as $np){
    printf (”

    • %s
    • “, $np->ID,$np->post_title);
      }
      ?>

      But just getting an empty unordered list right now.

      Thanks

Viewing 1 replies (of 1 total)
  • My guess is that they are using an RSS feed to do so…

    At least, it’s the easyest way I can see…

    S.

Viewing 1 replies (of 1 total)
  • The topic ‘Latest headlines window on home page’ is closed to new replies.