Override the listing loop

I’d like to override class-listings.php so I can hook into the while loop to inject banners and things. If you could recommend an alternative method or add the capacity to the roadmap I’d appreciate it.


Unfortunately there’s no way to override the class file itself, but you can override almost anything via hooks Home | HivePress Hook Reference If you mean injecting banners between listings the easiest way is probably using JS, or you can check if WordPress has hooks for overriding specific post queries (this would allow inserting a new item after the query runs).

A WordPress hook for overriding post queries would be ideal for reducing load times and layout shift. I’ll look into that, thank you.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.