Make WordPress Core

Changes between Version 5 and Version 6 of Ticket #62014


Ignore:
Timestamp:
09/16/2024 03:18:32 AM (15 months ago)
Author:
poena
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #62014 – Description

    v5 v6  
    1 I am opening this ticket tentatively to add the PHP changes from this Gutenberg PR:
     1This ticket is for adding the PHP changes from this Gutenberg PR:
    22[https://github.com/WordPress/gutenberg/pull/64167 Query loop / Post template: Enable post format filter]
    33
    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.
     4The 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.
    85
    96
    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.
     7The 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'.
    129
    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.
    1711
    1812
     
    3428
    3529In the Site Editor or block editor, insert a query loop with a format filter.
    36 Since the control itself is not included in the PR, you will need to open the code editor mode in the editor and manually add the format.
     30Since 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.
    3731In this example, I have used the gallery post format. I have added
    3832{{{"format":["gallery"]}}} inside {{{query}}}:
     
    6458
    6559In the editor and front, the query loop should only display posts that have no post format assigned.
     60
     61Testing the query pagination:
     62Set the number of posts to display per page to something low, so that the query pagination block shows on the front.
     63Then move between the listed pages and confirm that page 2 etc also shows posts with the correct post formats.