WordPress.org

Ready to get started?Download WordPress

Forums

List only the post, not the pages in recent 10 (2 posts)

  1. sundgot
    Member
    Posted 7 years ago #

    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>
    ';
    }
  2. muskokee
    Member
    Posted 7 years ago #

    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")):

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.