Advertisement
Guest User

custom sql query

a guest
Mar 29th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2.  
  3. $querystr = "
  4. SELECT *
  5. FROM $wpdb->posts
  6. ";
  7.  
  8. $pageposts = $wpdb->get_results($querystr, OBJECT);
  9.  
  10. ?>
  11.  
  12. <?php if ($pageposts): ?>
  13. <?php global $post; ?>
  14. <?php foreach ($pageposts as $post): ?>
  15. <?php setup_postdata($post); ?>
  16. <div class="post" id="post-<?php the_ID(); ?>">
  17. <h2><?php the_title(); ?></h2>
  18. <div><?php echo do_shortcode('[yasr_overall_rating size="small"]'); ?></div>
  19. </div>
  20. <?php endforeach; ?>
  21. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement