Last Entry/Post Wordpress

Blog Post by : MIFTAH - Ayahnya Allessa

just post a reminder for me if i want to place last post or last entry in wordpress.
place code below on anywhere you want to place that last post section.


Last Entry

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

    < ?
    $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 (”
  1. echo get_permalink($np->ID);
    print (”\”>$np->post_title
  2. “);
    } ?>

in this case, i place last post in sidebar.

2 Comments

  1. raffaell 2007-01-18, 12:58 AM

    Wah, kalo aku sih mendingan pake plugin yang udah ada aja, dulu pernah sering modif corenya wp, pas update nya, sakit banget, he he he

  2. Ayah Allessa 2007-01-18, 8:47 AM

    emang sih.. ehehe ntar gw coba pake plugin hihi
    thanks for mampirnya

Add a Comment





Lilypie 4th Birthday Ticker