Advertisement
swearwolf

Untitled

Jun 12th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. function custom_loop() {
  2. global $post;
  3. // arguments, adjust as needed
  4. $args = array(
  5. 'post_type' => 'project',
  6. 'posts_per_page' => 12,
  7. 'post_status' => 'publish',
  8. 'paged' => get_query_var( 'paged' )
  9. );
  10.  
  11. $loop = new WP_Query( $args );
  12.  
  13. if ( $loop->have_posts() ) :
  14.  
  15. while ( $loop->have_posts() ) : $loop->the_post(); ?>
  16. <div class="postwrap">
  17. <a href="<?php echo get_permalink(); ?>">
  18. <?php $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); ?>
  19. <div class="bkgnd" style="background: url('<?php echo $backgroundImg[0]; ?>') center center no-repeat;">
  20. <?php
  21. echo '<h2>' . get_the_title() . '</h2>';
  22. echo '</div></a></div>';
  23. endwhile;
  24.  
  25.  
  26. do_action( 'genesis_after_endwhile' );
  27. endif;
  28. wp_reset_postdata();
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement