Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php $the_query = new WP_Query( 'posts_per_page=5' ); ?>
- <?php $postLoops = 0 ?>
- <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
- <?php $postLoops++;
- if ($postLoops == 2) {
- echo '<div class="post-right-half">';
- }
- if ($postLoops == 1) {
- echo '<div class="post-left-half">';
- }
- ?>
- <div class="post-square">
- <div class="post-thumbnail" style="background-image: url(<?php the_post_thumbnail_url(); ?>);"><br></div>
- <div class="content-half">
- <h2 class="post-title"><?php the_title(); ?></h2>
- <p class="post-content"><?php the_excerpt(__('(more…)')); ?</p>
- <a class="read-more" href="<?php the_permalink() ?>">Read More <i class="fa fa-angle-right" aria-hidden="true"></i></a>
- </div>
- </div>
- <?php
- if ($postLoops == 3) {
- echo '</div>';
- }
- if ($postLoops == 1) {
- echo '</div>';
- }
- ?>
- <?php
- endwhile;
- wp_reset_postdata();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement