Posted By

Sulcalibur on 02/24/10


Tagged

wordpress


Versions (?)

Custom Loop/Query Based on Custom Fields


 / Published in: PHP
 

  1. <?php
  2.  
  3. $querydetails = "
  4. SELECT wposts.*
  5. FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
  6. WHERE wposts.ID = wpostmeta.post_id
  7. AND wpostmeta.meta_key = 'readmoretext'
  8. AND wpostmeta.meta_value = 'Go check this out'
  9. AND wposts.post_status = 'publish'
  10. AND wposts.post_type = 'post'
  11. ORDER BY wposts.post_date DESC
  12. ";
  13.  
  14. $pageposts = $wpdb->get_results($querydetails, OBJECT)
  15.  
  16. ?>

Report this snippet  

You need to login to post a comment.