Static content before posts in the loop, but after a sticky one when it exists

Question

I have a custom home page where usually there is a sticky post followed by regular posts, and between them, a static content to indicate where regular posts start. It’s something like this:

STICKY POST

<h3>Regular posts</h3>

Regular posts

To achieve this structure, I used a conditional is_sticky() in the loop and wrote the <h3>Regular… inside it.

It works like a charm when there is a sticky post, but it’s not always the case.

Is there a way to have a h3 title/any content before regular posts in the loop, but below the sticky post when it exists?

Thanks!

0
Rodrigo G. 3 weeks 0 Answers 3 views 0

Leave an answer