I have a hero section on the homepage of my blog that I’d like to be the main post and thereafter more posts with a different styles underneath, see below layout: .
I’m not sure how to really approach this and need some guidance in the best way to port this into WordPress. Here is the code I have so far in my index.php
file. I have managed to output the posts below the hero but not sure how to approach the main post in the hero/splash section.
<div id="main">
<!-- hero starts here -->
<div class="hero">
<div class="hero-wrapper">
<div class="article-info">
<p class="topic"><a href="">Culture</a></p>
<h1 class="hero-title"><a href="">Title</a></h1>
</div>
</div>
</div>
<!-- Hero end here -->
<div class="main-container">
<!-- Posts starts here -->
<div class="posts">
<div class="posts__post">
<article>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a class="posts__post--preview" href=""><img src="https://placeimg.com/470/310/tech" /></a>
<a class="posts__post--tag" href=""><p>Motivation</p></a>
<a class="posts__post--title" href="" ><h1>A Good Autoresponder, some more text here</h1></a>
<p class="posts__post--meta"> 10 days ago</p>
</article>
<?php endwhile; else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
</div>
</div>
<!-- Posts ends here -->
<!-- Main ends here -->
Things i’m thinking about:
- What happens if I add a new main post? Will the previous post be
pushed underneath?