Advertisement
chriscolstong3wy

wp_query_posts and masonry script

Jul 20th, 2013
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. <?php
  2. /**
  3. * Template Name: Masonry Blog
  4. *
  5. * Blog Template
  6. *
  7. */
  8. ?>
  9. <?php include_once( 'header.php' ); ?>
  10.  
  11. <!-- Start the Loop. -->
  12. insert sticky here
  13. <div id="sticky">
  14.  
  15. <?php
  16. $sticky = get_option( 'sticky_posts' );
  17. rsort( $sticky );
  18. $sticky = array_slice( $sticky, 0, 2 );
  19.  
  20. if (is_numeric($sticky[0])) {
  21. /* Query sticky posts */
  22. query_posts( array( 'post__in' => $sticky, 'caller_get_posts' =>1 ) );
  23. while ( have_posts() ) : the_post();
  24. the_post_thumbnail( array(920,540), $attr );
  25. the_title('<h3>', '</h3>');
  26.  
  27. if($post->post_excerpt) :
  28. the_excerpt();
  29.  
  30.  
  31. endif;
  32. endwhile; // End the loop.
  33.  
  34. wp_reset_query();
  35. }
  36. ?><div>
  37. <div id="container2">
  38.  
  39. <?php
  40. $temp = $wp_query;
  41. $wp_query= null;
  42. $wp_query = new WP_Query();
  43. $wp_query->query('posts_per_page=10'.'&paged='.$paged);
  44. while ($wp_query->have_posts()) : $wp_query->the_post();
  45. ?>
  46.  
  47.  
  48.  
  49. <div class="brick">
  50.  
  51. <div class="brick_featured_image">
  52. <?php if ( has_post_thumbnail() ) {
  53. $size=25;
  54. ?>
  55. <a href="<?php the_permalink() ?>" rel="bookmark" title="Click to view: <?php the_title_attribute(); ?>">
  56. <?php the_post_thumbnail( $size ); } ?>
  57. </a>
  58. <div class="brick_header">
  59. <a href="<?php the_permalink() ?>" rel="bookmark" title="Click to view: <?php the_title_attribute(); ?>">
  60. <?php the_title(); ?></a>
  61. </div>
  62. </div>
  63.  
  64. </div>
  65. <?php endwhile;?>
  66. <?php $wp_query = null; $wp_query = $temp;?>
  67. <!-- stop The Loop. -->
  68. </div><!-- container -->
  69. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement