• I am using the following code to pull a list of posts

    <?php
    
     $querydetails = "
       SELECT wposts.*
       FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
       WHERE wposts.ID = wpostmeta.post_id
       AND wpostmeta.meta_key = 'showscore'
       AND wpostmeta.meta_value = 'YES'
       AND wposts.post_status = 'publish'
       AND wposts.post_type = 'post'
       ORDER BY wposts.post_date DESC
     ";
    
     $pageposts = $wpdb->get_results($querydetails, OBJECT)
    
     ?>

    What I would like to do is have more than one list on the page. Each list needs to be defined by category. How do i make the above code only pull post from one category?
    I found a line of code on this page and tired inserting it and broke my list

    AND $wpdb->post2cat.category_id IN (48)

    Can someone help ??

    Thanks allot

    Steve

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Displaying Posts Using a Custom Select Query’ is closed to new replies.