Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WordPress Blocks / FSE / wp:query documentation

I am looking for the block markup / FSE documentation, for example in the twentytwentyfour theme archive.html template, there is this code :

wp:query-title {"type":"archive","align":"wide","style":{"typography":{"lineHeight":"1"},"spacing":{"padding":{"top":"var:preset|spacing|50"}}}}

Where can I find the documentation of available options for wp:query- ? Basically like the WP_Query PHP documentation page, but for blocks / FSE markup ? For exemple, I would like to display a taxonomy description in the archive, how can I achieve this ?

Do I need to create a PHP pattern containing the term_description() php function and then call it from the html template with wp:template-part ? Or is there a a thing like wp:query-term-description ?

I have been going through the documentation but could not find anything, thanks for your help.

like image 618
Pierre Avatar asked Feb 06 '26 00:02

Pierre


2 Answers

I've been looking for this very thing all day and finally got it.

You can find it in the "Query Loop patterns" section under the "Patterns" chapter https://developer.wordpress.org/themes/patterns/block-type-patterns/#query-loop-patterns

It doesn't explicitly indicate the options you have to query the Posts (or Custom Posts), but it includes an example where several of the possibilities are shown:


<!-- wp:query {"query":{"perPage":6,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false},"align":"wide"} -->
<div class="wp-block-query alignwide">
        <!-- wp:post-template {"style":{"spacing":{"blockGap":"var:preset|spacing|40"}},"layout":{"type":"grid","columnCount":2}} -->
        <!-- wp:post-featured-image {"isLink":true,"aspectRatio":"4/3","align":"wide"} /-->
        <!-- wp:post-title {"isLink":true,"fontSize":"large"} /-->
        <!-- wp:post-excerpt {"showMoreOnNewLine":false,"excerptLength":26} /-->
        <!-- wp:post-date /-->
    <!-- /wp:post-template -->
</div>
<!-- /wp:query -->

I hope it helps.

like image 91
ada Avatar answered Feb 07 '26 13:02

ada


Or is there a a thing like wp:query-term-description ?

Indeed, to display the taxonomy description, you would add the term description block: https://wordpress.org/documentation/article/term-description-block/

<!-- wp:term-description /-->
like image 36
Carolina Nymark Avatar answered Feb 07 '26 15:02

Carolina Nymark