masonjames

WP Kit

Aug 11th, 2012
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php /* Template Name: Top Kits */ ?>
  2.  
  3. <?php get_header(); ?>
  4.  
  5. <div id="main">
  6.  
  7. <?php do_action( 'bp_before_blog_page' ) ?>
  8.  
  9. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  10.  
  11. <div class="post" id="post-<?php the_ID(); ?>">
  12. <h2 class="post-title page-title"><?php the_title(); ?></h2>
  13. <div class="post-content">
  14. <?php the_content(); ?>
  15. </div>
  16.  
  17. <?php endwhile; endif; ?>
  18.  
  19. <div class="image-gallery">
  20.  
  21. <?php
  22. $total = $wpdb->get_var('SELECT count(p.id) FROM '.$wpdb->prefix.'posts p LEFT JOIN '.$wpdb->prefix.'postmeta pm ON p.id = pm.post_id WHERE p.post_status = \'publish\' AND post_type = \'kit\' AND pm.meta_key = \'_thumbnail_id\'');
  23.  
  24. load_template( TEMPLATEPATH . '/functions/paginate.php' );
  25.  
  26. $pages = new paginate(array(
  27. 'total' => $total,
  28. 'nr_per_page' => of_get_option( 'gallery_count', 5 ) + 1
  29. ));
  30.  
  31. $thumbs = $wpdb->get_results('SELECT p.ID,p.post_title FROM '.$wpdb->prefix.'posts p LEFT JOIN '.$wpdb->prefix.'postmeta pm ON p.id = pm.post_id WHERE p.post_status = \'publish\' AND post_type = \'kit\' AND pm.meta_key = \'_thumbnail_id\' ORDER BY p.post_date DESC LIMIT '.$pages->limit());
  32.  
  33. foreach ($thumbs as $thumb) : ?>
  34.  
  35. <div class="one_third">
  36. <div class="post-img-medium">
  37. <a href="<?php echo get_permalink($thumb->ID); ?>" rel="bookmark" title="<?php echo $thumb->post_title; ?>"><?php echo get_the_post_thumbnail($thumb->ID, 'post-medium'); ?></a>
  38. </div>
  39. </div>
  40.  
  41. <?php endforeach; ?>
  42.  
  43. <div class="clear"></div>
  44.  
  45. <div id="pagination">
  46. <?php echo $pages->nav() ?>
  47. </div>
  48.  
  49. </div>
  50.  
  51. </div><!--post-->
  52.  
  53. <?php do_action( 'bp_after_blog_page' ) ?>
  54.  
  55. </div><!--#main-->
  56.  
  57. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment