Hey @everyone,
I’m trying to make some customisations to the search results page (Listings), but I’ve run into a bit of a roadblock.
Essentially, I want to add custom content to this page. I previously used a code snippet to inject a custom block, which worked perfectly. However, when I try to tweak that snippet to insert my new custom content (FAQ), it renders completely unstyled and looks unprofessional.
To work around this, I tried a different approach: template overrides.
By overriding the template, I can easily recreate the default Listings page and add my new FAQ using Gutenberg blocks. The issue here is that overriding the Listings template also applies those changes to the /category/* pages. While that is fine for some of my custom content, it doesn’t work for my custom page title header. Because it’s a global template override, this custom title now displays on every category page, clashing with the categories’ existing headers.
I am looking for a solution to achieve one of the following:
-
Inject the custom title into the overridden template: Is there a way to make my current block-injection snippet work on an overridden template, rather than just the default one?
-
Apply conditional logic: How can I hide the custom page title from the overridden template when a user is viewing a category page (/category/*) instead of the main Listings search results page?
-
Fix the snippet styling: How can I ensure that content injected via the snippet method inherits the correct theme styling and renders properly?
Any guidance on the best approach would be greatly appreciated!
Cheers,
Chris 
Hey @everyone,
Just posting a quick update on this. As usual, it was niggling away in my brain, so I couldn’t help but try solving it with an AI assistant. I’m delighted to report that I’ve finally come up with a working PHP snippet and wanted to share it below for anyone else facing a similar customisation challenge! 
I ended up opting for the template override method. On the custom template, I added a shortcode block with: [my_custom_content]
I then added the following PHP via Code Snippets:
add_shortcode('my_custom_content', function() {
// Hide content on HivePress category, tag, or region pages
if ( is_tax( 'hp_listing_category' ) || is_tax( 'hp_listing_tag' ) || is_tax( 'hp_listing_region' ) ) {
return '';
}
// Render content on the main directory page and active search results
return 'INSERT CUSTOM CONTENT HERE';
});
The result is now working exactly as intended. I am able to see my custom shortcode content displayed on the default search landing page and on active search results pages, whilst the block safely remains hidden on /category/* pages, etc.
The other custom content that I added as Gutenberg blocks to the template override do appear on /category/* and /region/* pages, but in my use-case anyway; that’s fine.
I hope the community finds this useful. It took quite a few attempts to get right!
Cheers,
Chris 
1 Like
Hi,
Thanks for the update.
Unfortunately, once you override the entire template in the editor, snippets no longer get applied, because the editor version takes higher priority.
Snippets that target specific blocks within a template still work (for example, listing_view_block), since those operate on a lower level and don’t override the whole Listings template. In other words, each listing is treated as a separate block inside the Listings page template.
There is also no conditional logic available inside the editor. If you’ve already started customizing via snippets, it’s generally better to continue in that direction without overriding the template in the editor, as this preserves conditional logic and snippet-based customization.
The only workaround for conditions inside the editor is to assign a custom CSS class to a block and then hide/show it using CSS selectors based on body classes (for example, category-specific body classes can be used to target certain pages).
Hey @kseniia,
Thank you for clarifying exactly how the template hierarchy and priorities work behind the scenes. That makes total sense regarding the editor overrides taking precedence over structural snippets.
I’m currently really happy with my latest customisations, but I will definitely keep the body class CSS workaround in mind for future design tweaks!
I may experiment some more using the insights you’ve shared. My next idea that I might attempt involves implementing conditional blocks that only render unique content on specific category or region pages (such as tailored FAQs), though I am yet to fully implement this.
Thanks again for the excellent breakdown and guidance. It’s much appreciated! 
Cheers,
Chris 
1 Like