Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function custom_loop() {
- global $post;
- // arguments, adjust as needed
- $args = array(
- 'post_type' => 'project',
- 'posts_per_page' => 12,
- 'post_status' => 'publish',
- 'paged' => get_query_var( 'paged' )
- );
- $loop = new WP_Query( $args );
- if ( $loop->have_posts() ) :
- while ( $loop->have_posts() ) : $loop->the_post(); ?>
- <div class="postwrap">
- <a href="<?php echo get_permalink(); ?>">
- <?php $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); ?>
- <div class="bkgnd" style="background: url('<?php echo $backgroundImg[0]; ?>') center center no-repeat;">
- <?php
- echo '<h2>' . get_the_title() . '</h2>';
- echo '</div></a></div>';
- endwhile;
- do_action( 'genesis_after_endwhile' );
- endif;
- wp_reset_postdata();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement