• Hello,

    I’m new in WordPress and I’m trying to build a static front page
    that would look the same as the default one, except that I don’t want it to show the recent posts but only the one I choose.

    I have found this piece of code in WordPress, but I don’t know how to customize a CSS so that posts appear in an ordered list with the CSS ID whats-new.

    <?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 ?>
    <ol id=”whats-new”>
    <?
    $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
    • “, get_permalink($np->ID),$np->post_title);
      } ?>

      Thanks for your help.

  • The topic ‘how to customize a CSS so that posts appear in an ordered list ?’ is closed to new replies.