Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Query loop / Post template: Enable post format filter (WordPress#64167)
Enables filtering the query loop result by post format. To allow querying a given post format, a new parameter, `format` is added to a new compatibility class called `Gutenberg_REST_Posts_Controller_6_7`, which extends the core class `WP_REST_Posts_Controller`. Query loop block: - Adds a new parameter, `format`, to the `query` attribute in block.json. - Adds a new `FormatControls` that uses a list of supported post formats inside a `FormTokenField`. This control is placed in the `Filters` panel in the block settings sidebar. - Adds a new utility function `gutenberg_add_format_query_vars_to_query_loop_block` to ensure that the Query loop block can pass the new `format` argument correctly to `WP_Query`. This function is hooked into `query_loop_block_query_vars`. Post Template block: The new `format` parameter is passed from the query loop block to the post template block as part of the `query` attribute. --------- Co-authored-by: carolinan <poena@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: dmsnell <dmsnell@git.wordpress.org> Co-authored-by: TimothyBJacobs <timothyblynjacobs@git.wordpress.org> Co-authored-by: nickbohle <nickbohle@git.wordpress.org> Co-authored-by: SergeyBiryukov <sergeybiryukov@git.wordpress.org> Co-authored-by: justintadlock <greenshady@git.wordpress.org>
- Loading branch information