Allow query_results_count to reference a Query element by name or custom ID instead of internal element ID

Hi,

I’m using the {query_results_count} dynamic tag and I think it’s a great addition. However, I’ve run into a limitation that makes it difficult to build reusable templates.

Currently the dynamic tag only works with the internal Bricks element ID, for example:
{query_results_count:imqafs}

This works well, but the internal element ID is not something that users can easily identify or maintain when templates become more complex.

I tested several alternatives without success:
OK - Internal Bricks element ID → works
NO - CSS ID assigned to the Query Loop element
NO - Custom Element ID (“Add element ID if needed”)
NO - Element name shown in the Structure panel

One feature request that would make this much more robust would be allowing query_results_count to reference either {query_results_count:downloads} where “downloads” is the element name (similar to how Bricks filters can reference a Query Loop), or alternatively a custom persistent Query ID.

Why would this be useful?

A common use case is showing or hiding sections based on whether a Query Loop returns any results.

For example:

  • hide the “Downloads” section when an ACF Repeater is empty
  • hide a “Related projects” section if no related posts exist
  • display a slider only when more than one slide is available

Currently this requires referencing an internal element ID, which is difficult to understand and maintain in larger projects.

Being able to reference the Query Loop by name (or another stable identifier) would make templates much easier to build, duplicate and maintain.

Thanks!