WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Mini-loop – little code tweak help

[Resolved] Mini-loop – little code tweak help

  • I am using the mini-loop on a home page. I want to display the post content.
    Also I would maybe like to display the excerpt instead.
    This code is successful in fetching the latest post and displaying the title. How can I get it to display the content and how could I get it to display the excerpt?
    thanks.

    code:
    <?php
    $how_many=1;
    require_once("/wp-config.php"); ?>

    <ul id="whats-new">
    <?
    $news=$wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts
    WHERE
    post_status= \"publish\" ORDER BY 'ID' DESC LIMIT ".$how_many);
    foreach($news as $np){
    print ("<li><a href=\"");
    echo get_permalink($np->ID);
    print ("\">$np->post_title</a></li>");
    } ?>
    </ul>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Mini-loop – little code tweak help’ is closed to new replies.