Options to remove some unnecessary query block wrappers


After playing a bit with queries, here a few wrappers I could live without:

  • main query wrapper
  • query item inner wrapper
  • post content

For the post content block, I guess a block option to remove the wrapper could be nice and easy to add.
(In the meantime I use get_the_content() in a code block, but I hate to see those Gutenberg comments!)

As for the others, I don’t know the inner mechanics of Cwicly query block, but in my opinion they should be removable as well.


I have also been wondering about this. Most other users probably haven’t noticed this, but as I am a bit of a perfectionist, I want to have control over every line of code and make it as clean as possible.
I have a problem with “cc-query-item” which I cannot control. Meaning, I cannot add my own class to it or change its HTML tag (for example, using “article” instead of “div”).
I was also wondering if it would be possible to merge the query and query template together, instead of having them as two separate wrappers in the frontend. I am not sure if it is possible with the current setup. Probably not because we cannot forget about pagination as well which should be under query but outside query-template.
Ok, maybe at least an option to remove IDs for query and query-template when they are disabled in particular block settings?
In an ideal world, I would like the query to look like this.

<div class="query custom-class" data-query_id="94">
 <div class="query-template custom-class">
   <article class="cc-query-item custom-class">
     Post item content whatever it is...

But upon looking at your code, @yankiara, you should check your query setup. The two additional divs marked in red after “cc-query-item” are probably caused by you, as there is nothing outputted by the query after “cc-query-item” besides the content you generated. At least, that is the case for me.

1 Like

Totally agree with you for cc-query-item control.

And that’s exactly why I have div wrapper inside it.

I posted some generic screenshot, but the div is actually needed to customize item container TAG (for instance article, like you mentionned) or to make it a LINK, which doesn’t seem possible with cc-query-item.

As for the last div wrapper in red, it’s not from me but like I tried to explain from the post content block :wink:
And I’d like it to be removable as well.