Hi Gerry, thanks for pointing me into the right direction.
It seems I was using the wrong block after all. When I apply the blockGap to core/post-template, at least some code is added to the <head> in <style id='wp-block-post-template-inline-css'>
:
.wp-block-post-template-is-layout-flex {
gap: 48px;
}
.wp-block-post-template-is-layout-grid {
gap: 48px;
}
At first glance, this looks right, but this is not the class applied to the <ul> containing the query items (truncated for readability):
<div class="wp-block-query alignwide is-layout-flow wp-block-query-is-layout-flow">
<ul class="is-flex-container columns-3 wp-block-post-template is-layout-flow wp-block-post-template-is-layout-flow">
<li class="wp-block-post">...</li>
<li class="wp-block-post">...</li>
<li class="wp-block-post">...</li>
</ul>
...
</div>
The class applied to the <ul> is .is-flex-container. And this class has the rule
.wp-block-post-template.is-flex-container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: 1.25em;
}
applied in
<style id='wp-block-post-template-inline-css'>
This is the code from my index.html template:
<!-- wp:query {"queryId":1,"query":{"perPage":12,"offset":0,"postType":"post","categoryIds":[],"tagIds":[],"order":"desc","orderBy":"date","author":"","search":"","sticky":""},"displayLayout":{"type":"flex","columns":3}} -->
<div class="wp-block-query alignwide">
<!-- wp:post-template -->
<!-- wp:post-featured-image {"isLink":true} /-->
<!-- wp:group {"className":"entry-header"} -->
<div class="wp-block-group entry-header">
<!-- wp:post-terms {"term":"category"} /-->
<!-- wp:post-title {"level":2,"isLink":true} /-->
<!-- wp:post-date /-->
</div>
<!-- /wp:group -->
<!-- wp:post-excerpt /-->
<!-- /wp:post-template -->
I am using "displayLayout":{"type":"flex","columns":3}
on the <!-- wp:query -->
comment, which, I assume, applies the .is-flex-container
class to the <ul>. Oddly enough, it also applies is-layout-flow
, which does have my 48px applied to margin-block-start (which, of course, is ignored in flexbox).
Obviously, I could just override the class .is-flex-container
, but I would like to understand how it should be done the right way. But maybe the right way is styling the theme with proper CSS for now ??