• I used this code to add list of 15 latest post’ titles to my non-wordpress index page:

    <?php
    $how_many=15; //How many posts do you want to show
    require_once("wp-config.php"); // Change this for your path to wp-config.php file ?>
    
    <ol id="whats-new">
    <?
    $news=$wpdb->get_results("SELECT <code>ID</code>,<code>post_title</code> FROM $wpdb->posts
    WHERE <code>post_status</code>= \"publish\" ORDER BY 'ID' DESC LIMIT ".$how_many);
    foreach($news as $np){
    printf ("<li><a href=\"index.php?p=%s\" target=\"_blank\">%s</a></li>", $np->ID,$np->post_title);
    }?>
    </ol>

    It add to my page list like this (It’s just bla bla bla):

    Screenshot.

    How should I edit this code if i wanna see something like:

    date title time

    17.02 Post title (17:58)
    17.02 Another one Brithey’s nude shot (16:45)
    16.02 OMG! Milo rocks! ( 14:25)

    And whit character should i use to add spaces (like &nbsp; in html)?

    And the last. Do you know the code that let me insert in my template text of the last article i’ve posted?

    If someone knows please help! Millions thanx)

  • The topic ‘HOW TO: 1) edit miniloop for static page 2) insert text of last post into page’ is closed to new replies.