• My sidebar does a call up for Recent Posts. Since the upgrade to 2.1, these now include Pages (if Pages have been added). Any way to exclude Pages from this query? I looked at the Codex, but could not quite figure it out. From what I can tell… Here is the code that pulls up the Recent Posts in my sidebar.php.

    \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 5”)):
    \

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Desdichado

    (@desdichado)

    That did it. Thanks!

    ok so definately a beginner, and i cant seem to get the pages out of my recent posts

    any help would be appriciated ??

    It would be a wise thing to tell what code/plugin are you using to display your recent posts. Otherwise it’s just useless guessing…

    On the other hand the article at the link above explains it quite clearly.

    well thats just it, i read the article and i do understand why it is doing this. tho maybe i am missing it but i dont know where to start in fixing this i am very new to wordpress having being used to cutenews.

    and there is no “code/plugin” that is being used. its just WP on its own that is doing this.

    as in where do i start?

    so this is the code, that is in my side bar… that has anything to do with recent posts, other than that i dont know what i am looking for to change it

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

    I still doubt you’ve read that article. It says clearly: add post_type='post' to your code…

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Recent Posts Including Pages’ is closed to new replies.