Make WordPress Core

Changes between Initial Version and Version 2 of Ticket #62014


Ignore:
Timestamp:
09/09/2024 11:32:22 AM (15 months ago)
Author:
poena
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #62014

    • Property Keywords has-patch added
  • Ticket #62014 – Description

    initial v2  
    1414{{{WP_REST_Posts_Controller}}}. Changes are made to these class methods: get_item and get_collection_params.
    1515
    16 'Format' is also added to the function {{{build_query_vars_from_query_block}}}, to display the correct posts on the front.
     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.
    1717
     18
     19----
     20
     21== Testing instructions
     22
     23How to test the post formats filter without the rest of the Gutenberg changes.
     24
     25First, please enable post formats on the active theme. Example:
     26{{{
     27function twentytwentyfour_post_formats() {
     28        add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat' ) );
     29}
     30add_action( 'after_setup_theme', 'twentytwentyfour_post_formats' );
     31}}}
     32
     33On your WordPress test install, create a few posts with and without formats assigned.
     34
     35In the Site Editor or block editor, insert a query loop with a format filter.
     36In this example, I have used the gallery post format. I have added
     37{{{"format":["gallery"]}}} inside {{{query}}}:
     38
     39{{{
     40<!-- wp:query {"query":{"perPage":10,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true,"format":["gallery"]}} -->
     41<div class="wp-block-query">
     42    <!-- wp:post-template -->
     43    <!-- wp:post-title /-->
     44    <!-- /wp:post-template -->
     45</div>
     46<!-- /wp:query -->
     47}}}
     48
     49
     50In the editor, the query loop should only display posts with the gallery post format.
     51
     52Next, change the format to standard:
     53
     54{{{
     55<!-- wp:query {"query":{"perPage":10,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":true,"format":["standard"]}} -->
     56<div class="wp-block-query">
     57    <!-- wp:post-template -->
     58    <!-- wp:post-title /-->
     59    <!-- /wp:post-template -->
     60</div>
     61<!-- /wp:query -->
     62}}}
     63
     64In the editor, the query loop should only display posts that have no post format assigned.
     65
     66--
     67
     68On the front, the query loop does not show any results: I am still figuring out if this is because part of the block changes are missing or if there are problems with {{{build_query_vars_from_query_block}}} in this PR.
     69