Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- CUSTOM SECTION START -->
- <div class="container">
- <div class="row">
- <?php
- $posts_per_first_section = 5; //how many posts you want to show in the first section//
- $args = array(
- 'post_type' => 'post',
- 'posts_per_page' => 11,
- );
- $blogposts = new WP_Query($args);
- while($blogposts->have_posts()) {
- $blogposts->the_post();
- if ($blogposts->current_post < 2) :
- ?>
- <div class="col-md-6">
- <?php else : ?>
- <div class="col-md-4">
- <?php endif; ?>
- <a href="<?php the_permalink(); ?>">
- <div class="card border-0">
- <div class="card-picture">
- <img class="card-img" src="<?php echo
- get_the_post_thumbnail_url(get_the_ID()); ?>" alt="Card image">
- <div class="card-img-overlay d-flex flex-column">
- <h5 class="card-title font-weight-bold"><?php the_title(); ?></h5>
- <div class="mt-auto"><?php the_author(); ?> - <i class="fas fa-
- clock"></i> - <?php the_time('d/m/Y')?></div>
- </div>
- </div>
- </div>
- </a>
- </div>
- <?php
- //check for 'break' out of first loop//
- if( $blogposts->current_post+1 == $posts_per_first_section ) break;
- } //end of the first 'while' loop//
- ?>
- </div> <!-- closing html for first loop -->
- </div> <!-- closing html for first loop -->
- <?php //checking if there are more posts to show in second loop
- if( $blogposts->current_post > 0 && $blogposts->current_post+1 < $blogposts->found_posts ) : ?>
- <!-- opening html for second loop -->
- <div class="container">
- <div class="row">
- <div class="col-md-8">
- <?php
- while($blogposts->have_posts()) {
- $blogposts->the_post();
- ?>
- <div class="card-3">
- <div class="row no-gutters">
- <div class="col-md-5">
- <a href="<?php the_permalink(); ?>">
- <img class="card-3-img card-img-top h-100" src="<?php echo get_the_post_thumbnail_url(get_the_ID()); ?>" alt="...">
- </a>
- </div>
- <div class="col-md-7">
- <div class="card-body">
- <a href="<?php the_permalink(); ?>">
- <h5 class="card-title-3"><?php the_title(); ?></h5>
- </a>
- <span class="card-text"><?php the_excerpt(); ?></span>
- <div class="mt-auto"><?php the_author(); ?> - <i class="fas
- fa-clock"></i> - <?php the_time('d/m/Y')?></div>
- </div>
- </div>
- </div>
- </div>
- <?php } ?>
- </div> <!-- closing html for second loop -->
- </div> <!-- closing html for second loop -->
- </div> <!-- closing html for second loop -->
- <?php endif; //end checking if there are more posts to show in second loop
- ?>
- <!-- CUSTOM SECTIION END -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement