Changes between Version 5 and Version 6 of Ticket #62014
- Timestamp:
- 09/16/2024 03:18:32 AM (15 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #62014 – Description
v5 v6 1 I am opening this ticket tentatively to addthe PHP changes from this Gutenberg PR:1 This ticket is for adding the PHP changes from this Gutenberg PR: 2 2 [https://github.com/WordPress/gutenberg/pull/64167 Query loop / Post template: Enable post format filter] 3 3 4 At the time of opening this issue, this linked PR has not yet been approved, and this ticket should not be committed. 5 I expect that there will be some additional changes to the PR. 6 7 I could use help with adding a better summary (ticket title) and clearer description, but I will try my best. 4 The Gutenberg PR linked above adds a new filter and a new interface control to the Query Loop block, that the user can use to display posts (or other post types) that have post formats assigned. 8 5 9 6 10 The Gutenberg PR linked above adds a new filter to the Query Loop block,11 that the user can use to display posts (or other post types) that have post formats assigned.7 The PR for this Trac ticket adds a new parameter called 'format' to the class 8 {{{WP_REST_Posts_Controller}}}. Changes are made to these class methods: 'get_item' and 'get_collection_params'. 12 9 13 The PR adds a new parameter called 'format' to the class 14 {{{WP_REST_Posts_Controller}}}. Changes are made to these class methods: get_item and get_collection_params. 15 16 'Format' is also added to the function {{{build_query_vars_from_query_block}}}, which is used to display the correct posts on the front. 10 'Format' is also added to the function {{{build_query_vars_from_query_block}}}, to ensure that it is passed correctly to 'WP_Query' during the server-side render of the block. 17 11 18 12 … … 34 28 35 29 In the Site Editor or block editor, insert a query loop with a format filter. 36 Since the control itself is not included in th ePR, you will need to open the code editor mode in the editor and manually add the format.30 Since the control itself is not included in this PR, you will need to open the code editor mode in the editor and manually add the format. 37 31 In this example, I have used the gallery post format. I have added 38 32 {{{"format":["gallery"]}}} inside {{{query}}}: … … 64 58 65 59 In the editor and front, the query loop should only display posts that have no post format assigned. 60 61 Testing the query pagination: 62 Set the number of posts to display per page to something low, so that the query pagination block shows on the front. 63 Then move between the listed pages and confirm that page 2 etc also shows posts with the correct post formats.