Title: Query Header
Last modified: September 8, 2026

---

# Query Header

 *  [Back to Front](https://wordpress.org/support/users/traverser11/)
 * (@traverser11)
 * [3 weeks, 1 day ago](https://wordpress.org/support/topic/query-header/)
 * I’d love to be able to make a query header
 * ie: IF(has posts) { do something }
   eg. if there are upcoming events, display 
   the heading ‘upcoming events’, if there are not upcoming events don’t display
   the heading.
 * am i missing something? i miss doing this in php!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Ryan Welcher](https://wordpress.org/support/users/welcher/)
 * (@welcher)
 * [3 weeks ago](https://wordpress.org/support/topic/query-header/#post-19015626)
 * You should be able to do this using the template in AQL using the the No Results
   section.
 *  Thread Starter [Back to Front](https://wordpress.org/support/users/traverser11/)
 * (@traverser11)
 * [2 weeks, 6 days ago](https://wordpress.org/support/topic/query-header/#post-19017131)
 * Hey thanks for reply,
   Sorry i don’t understand how to use the No Results section
   for this?I want a header above the query, only if the query has posts – (eg. 
   Show a heading ‘upcoming events’ but only when there are events coming up)So 
   the No Results section only displays if the query returns no posts, right?I’ve
   worked around this with css :empty actually,putting the query and a heading inside
   a group block with the class `community-events-content`But it would be ideal 
   and give more control to do this in the block settings
 * `.community-events-content:has(~ .wp-block-query:empty) {
   display: none;}
 *  Plugin Author [Ryan Welcher](https://wordpress.org/support/users/welcher/)
 * (@welcher)
 * [1 week, 6 days ago](https://wordpress.org/support/topic/query-header/#post-19022539)
 * Ah! Sorry, I misunderstood what you are trying to do. I have been thinking about
   this and I think we make this work. Leave it with me!

Viewing 3 replies - 1 through 3 (of 3 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fquery-header%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/advanced-query-loop/assets/icon-256x256.png?rev=3674690)
 * [Advanced Query Loop](https://wordpress.org/plugins/advanced-query-loop/)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-query-loop/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-query-loop/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-query-loop/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-query-loop/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Ryan Welcher](https://wordpress.org/support/users/welcher/)
 * Last activity: [1 week, 6 days ago](https://wordpress.org/support/topic/query-header/#post-19022539)
 * Status: not resolved