Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $the_query = new WP_Query(
- array(
- 'post_type' => 'sponsors',
- 'posts_per_page' => 4
- )
- );
- if ( $the_query->have_posts() ) {
- while ( $the_query->have_posts() ) {
- $the_query->the_post();
- $counter = 0;
- echo '<section class="sponsor-row">';
- if ( has_post_thumbnail() ) {
- $counter++;
- echo '<div class="grid half">';
- echo '<a class="sponsor" href="'.get_the_permalink().'" target="_blank">';
- the_post_thumbnail( 'full' );
- echo '</a>';
- echo '</div>';
- if ($counter <= 2){
- echo '</section>';
- }
- }
- }
- }
- wp_reset_postdata();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement