WordPress.org

Support

Support » Plugins and Hacks » List only the post, not the pages in recent 10

List only the post, not the pages in recent 10

  • Hi.
    How do I list only the post, not the pages in recent 10…?
    What of the two codesnippets do I have to edit and how…?

    if ( $recentposts = $wpdb->get_results
    ("SELECT ID, post_title FROM $wpdb->posts
    WHERE post_status = 'publish'
    AND post_date_gmt < '$today'
    ORDER BY post_date DESC LIMIT 10")):

    ————-

    foreach ($recentposts as $post) {
    if ($post->post_title == '')
    $post->post_title = sprintf(__('Post #%s'),
    $post->ID);
    echo "
    
    <li><a>ID)."'>";
    the_title();
    echo '</a></li>
    ';
    }

Viewing 1 replies (of 1 total)
  • if ( $recentposts = $wpdb->get_results
    (“SELECT ID, post_title FROM $wpdb->posts
    WHERE post_status = ‘publish’
    AND post_date_gmt < ‘$today’ AND post_type = ‘post’
    ORDER BY post_date DESC LIMIT 10″)):

Viewing 1 replies (of 1 total)
  • The topic ‘List only the post, not the pages in recent 10’ is closed to new replies.
Skip to toolbar