• I’m using the code below to display the titles of the last 8 posts on a static page:

    <?php
    # Here starts Mini Loop trick: You can use this code, but _at your own risk_
    # If you want to improve this code, you’re welcome 😉
    $how_many=8; //How many posts do you want to show
    ?>
    <ul id=”news”>
    <?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);
      }
      ?>

      Now I want also to show the value of a custom field after the title, does anyone know how to realize this?

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display Custom Fields posts on static page’ is closed to new replies.