Making WordPress.org

Changeset 13834


Ignore:
Timestamp:
06/19/2024 01:43:38 AM (2 years ago)
Author:
adamwood
Message:

Learn: Sync with git WordPress/learn@81fefad

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/functions.php

    r13833 r13834  
    1212require_once __DIR__ . '/src/sensei-meta-list/index.php';
    1313require_once __DIR__ . '/inc/block-config.php';
     14require_once __DIR__ . '/inc/query.php';
    1415
    1516/**
    … …  
    3031        return $args;
    3132} );
    32 add_action( 'pre_get_posts', __NAMESPACE__ . '\modify_learning_pathways_query' );
    3333
    3434/**
    … …  
    280280        return $breadcrumbs;
    281281}
    282 
    283 /**
    284  * Modify the main query.
    285  * If the 'all' level filter is set in the query, remove it to return all posts.
    286  *
    287  * @param WP_Query $query The main query.
    288  * @return WP_Query
    289  */
    290 function modify_learning_pathways_query( $query ) {
    291         if ( is_admin() || ! $query->is_main_query() ) {
    292                 return;
    293         }
    294 
    295         $level = $query->get( 'wporg_lesson_level' );
    296 
    297         if ( 'all' === $level ) {
    298                 $query->set( 'wporg_lesson_level', '' );
    299         }
    300 
    301         return $query;
    302 }
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/inc/block-config.php

    r13833 r13834  
    1515add_filter( 'wporg_query_filter_options_taxonomy-topic', __NAMESPACE__ . '\get_taxonomy_topic_options' );
    1616add_filter( 'wporg_query_filter_options_learning-pathway-topic', __NAMESPACE__ . '\get_learning_pathway_topic_options' );
    17 add_action( 'pre_get_posts', __NAMESPACE__ . '\modify_query' );
    1817add_action( 'wporg_query_filter_in_form', __NAMESPACE__ . '\inject_other_filters' );
    1918
    … …  
    389388
    390389/**
    391  * Modify the query by adding meta query for language if set.
    392  *
    393  * @param WP_Query $query The query object.
    394  */
    395 function modify_query( $query ) {
    396         // Ensure this code runs only for the main query on archive pages
    397         if ( ! is_admin() && $query->is_main_query() && $query->is_archive() ) {
    398                 if ( isset( $_GET['language'] ) && is_array( $_GET['language'] ) ) {
    399                         $languages = array_map( 'sanitize_text_field', $_GET['language'] );
    400 
    401                         $meta_query = array( 'relation' => 'OR' );
    402 
    403                         $meta_query[] = array(
    404                                 'key'     => 'language',
    405                                 'value'   => $languages,
    406                                 'compare' => 'IN',
    407                         );
    408 
    409                         // If 'en_US' is included, include posts with no language defined
    410                         // as this is the default value for the meta field.
    411                         if ( in_array( 'en_US', $languages ) ) {
    412                                 $meta_query[] = array(
    413                                         'key'     => 'language',
    414                                         'compare' => 'NOT EXISTS',
    415                                 );
    416                         }
    417 
    418                         $query->set( 'meta_query', $meta_query );
    419                 }
    420         }
    421 }
    422 
    423 /**
    424390 * Add in the other existing filters as hidden inputs in the filter form.
    425391 *
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/patterns/search-content.php

    r13775 r13834  
    88?>
    99
    10 <!-- wp:query {"queryId":0,"query":{"inherit":true,"perPage":25},"align":"wide"} -->
    11 <div class="wp-block-query alignwide">
     10<!-- wp:group {"align":"wide","layout":{"type":"flex","flexWrap":"wrap","justifyContent":"space-between"},"style":{"spacing":{"margin":{"top":"0","bottom":"var:preset|spacing|50"}}}} -->
     11<div class="wp-block-group alignwide" style="margin-top:0;margin-bottom:var(--wp--preset--spacing--50)">
    1212
    13         <!-- wp:group {"className":"align-left","layout":{"type":"constrained","contentSize":"","justifyContent":"left"},"style":{"spacing":{"margin":{"bottom":"var:preset|spacing|40"}}}} -->
    14         <div class="wp-block-group align-left" style="margin-bottom:var(--wp--preset--spacing--40)">
     13        <!-- wp:search {"label":"<?php esc_attr_e( 'Search', 'wporg-learn' ); ?>","showLabel":false,"placeholder":"<?php esc_attr_e( 'Search learning resources', 'wporg-learn' ); ?>","width":255,"widthUnit":"px","buttonText":"<?php esc_attr_e( 'Search', 'wporg-learn' ); ?>","buttonPosition":"button-inside","buttonUseIcon":true,"className":"is-style-secondary-search-control wporg-filtered-search-form"} /-->
    1514
    16                 <!-- wp:group {"align":"wide","className":"wporg-search-controls","layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"space-between","verticalAlignment":"top"},"style":{"spacing":{"margin":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20"}}}} -->
    17                 <div id="wporg-search" class="wp-block-group alignwide wporg-search-controls" style="margin-top:var(--wp--preset--spacing--20);margin-bottom:var(--wp--preset--spacing--20)">
    18        
    19                         <!-- wp:search {"label":"<?php esc_attr_e( 'Search', 'wporg-learn' ); ?>","showLabel":false,"placeholder":"<?php esc_attr_e( 'Search learning resources', 'wporg-learn' ); ?>","width":232,"widthUnit":"px","buttonText":"<?php esc_attr_e( 'Search', 'wporg-learn' ); ?>","buttonPosition":"button-inside","buttonUseIcon":true,"className":"is-style-secondary-search-control wporg-filtered-search-form"} /-->
    20                
     15</div>
     16<!-- /wp:group -->
     17
     18<!-- wp:wporg-learn/search-results-context {"style":{"spacing":{"padding":{"bottom":"var:preset|spacing|20"}},"elements":{"link":{"color":{"text":"var:preset|color|charcoal-4"}}}},"textColor":"charcoal-4","fontSize":"small"} /-->
     19
     20<!-- wp:query {"queryId":1,"query":{"perPage":12,"postType":"course","courseFeatured":false,"inherit":true},"namespace":"wporg-learn/course-grid","align":"wide","className":"wporg-learn-course-grid"} -->
     21<div class="wp-block-query alignwide wporg-learn-course-grid">
     22
     23        <!-- wp:post-template {"style":{"spacing":{"blockGap":"var:preset|spacing|50"}},"layout":{"type":"grid","columnCount":null,"minimumColumnWidth":"330px"}} -->
     24
     25                <!-- wp:group {"style":{"border":{"width":"1px","color":"var:preset|color|light-grey-1","radius":"2px"},"spacing":{"blockGap":"0"},"dimensions":{"minHeight":"100%"}},"backgroundColor":"white","layout":{"type":"flex","orientation":"vertical"}} -->
     26                <div class="wp-block-group has-border-color has-white-background-color has-background" style="border-color:var(--wp--preset--color--light-grey-1);border-width:1px;border-radius:2px;min-height:100%">
     27
     28                        <!-- wp:post-featured-image {"style":{"spacing":{"margin":{"bottom":"0"}}}} /-->
     29
     30                        <!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20","left":"20px","right":"20px"}}},"layout":{"type":"constrained"}} -->
     31                        <div class="wp-block-group" style="padding-top:var(--wp--preset--spacing--20);padding-right:20px;padding-bottom:var(--wp--preset--spacing--20);padding-left:20px">
     32
     33                                <!-- wp:post-title {"level":3,"isLink":true,"style":{"typography":{"fontStyle":"normal","fontWeight":"600","lineHeight":1.6},"spacing":{"margin":{"bottom":"0"}},"elements":{"link":{"color":{"text":"var:preset|color|blueberry-1"}}}},"fontSize":"normal","fontFamily":"inter"} /-->
     34
     35                                <!-- wp:post-excerpt {"showMoreOnNewLine":false,"excerptLength":16,"style":{"spacing":{"margin":{"top":"var:preset|spacing|10"}},"typography":{"lineHeight":1.6}}} /-->
     36
     37                                <!-- wp:group {"layout":{"type":"flex","flexWrap":"wrap","justifyContent":"left"}} -->
     38                                <div class="wp-block-group">
     39
     40                                        <!-- wp:wporg-learn/learning-duration {"style":{"elements":{"link":{"color":{"text":"var:preset|color|charcoal-4"}}}},"textColor":"charcoal-4","fontSize":"small"} /-->
     41
     42                                        <!-- wp:wporg-learn/lesson-count {"style":{"layout":{"selfStretch":"fill","flexSize":null}},"fontSize":"extra-small"} /-->
     43
     44                                        <!-- wp:wporg-learn/course-status {"fontSize":"extra-small"} /-->
     45
     46                                </div>
     47                                <!-- /wp:group -->
     48
     49                        </div>
     50                        <!-- /wp:group -->
     51
    2152                </div>
    2253                <!-- /wp:group -->
    2354
    24                 <!-- wp:wporg-learn/search-results-context {"style":{"spacing":{"padding":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20"}},"elements":{"link":{"color":{"text":"var:preset|color|charcoal-4"}}}},"textColor":"charcoal-4","fontSize":"small"} /-->
     55        <!-- /wp:post-template -->
    2556
    26                 <!-- wp:post-template {"align":"wide"} -->
     57        <!-- wp:query-no-results -->
    2758
    28                         <!-- wp:post-title {"isLink":true} /-->
     59                <!-- wp:heading {"level":1,"fontFamily":"eb-garamond"} -->
     60                <h1 class="wp-block-heading has-eb-garamond-font-family"><?php esc_html_e( 'No results found', 'wporg-learn' ); ?></h1>
     61                <!-- /wp:heading -->
    2962
    30                         <!-- wp:post-excerpt /-->
     63                <!-- wp:paragraph {"placeholder":"Add text or blocks that will display when a query returns no results."} -->
     64                <p><?php esc_html_e( 'Try a different search, or clearing filters.', 'wporg-learn' ); ?></p>
     65                <!-- /wp:paragraph -->
    3166
    32                 <!-- /wp:post-template -->
    33 
    34                 <!-- wp:query-no-results -->
    35                
    36                         <!-- wp:paragraph {"placeholder":"Add text or blocks that will display when a query returns no results.","style":{"spacing":{"margin":{"top":"var:preset|spacing|40"}}}} -->
    37                         <p style="margin-top:var(--wp--preset--spacing--40)"><?php esc_attr_e( 'Sorry, but nothing matched your search terms.', 'wporg-learn' ); ?></p>
    38                         <!-- /wp:paragraph -->
    39 
    40                 <!-- /wp:query-no-results -->
    41        
    42         </div>
    43         <!-- /wp:group -->
     67        <!-- /wp:query-no-results -->
    4468
    4569        <!-- wp:query-pagination {"layout":{"type":"flex","justifyContent":"center"}} -->
     70
    4671                <!-- wp:query-pagination-previous {"label":"Previous"} /-->
    4772
    … …  
    4974
    5075                <!-- wp:query-pagination-next {"label":"Next"} /-->
     76
    5177        <!-- /wp:query-pagination -->
    5278
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/style.css

    r13833 r13834  
    55 * Author URI: http://wordpress.org/
    66 * Description: A theme for learn.wordpress.org, built in 2024.
    7  * Version: 1.0.0-8e53021
     7 * Version: 1.0.0-09d8faa
    88 * License: GNU General Public License v2 or later
    99 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/templates/search.html

    r13775 r13834  
    44<main class="wp-block-group alignfull" style="padding-left:var(--wp--preset--spacing--edge-space);padding-right:var(--wp--preset--spacing--edge-space)">
    55
    6         <!-- wp:pattern {"slug":"wporg-learn-2024/search-content"} /-->
     6        <!-- wp:group {"align":"full","style":{"spacing":{"padding":{"left":"var:preset|spacing|edge-space","right":"var:preset|spacing|edge-space","top":"var:preset|spacing|50","bottom":"var:preset|spacing|50"}}},"layout":{"type":"constrained"}} -->
     7        <div class="wp-block-group alignfull" style="padding-top:var(--wp--preset--spacing--50);padding-right:var(--wp--preset--spacing--edge-space);padding-bottom:var(--wp--preset--spacing--50);padding-left:var(--wp--preset--spacing--edge-space)">
     8
     9                <!-- wp:pattern {"slug":"wporg-learn-2024/search-content"} /-->
     10
     11        </div>
     12        <!-- /wp:group -->
    713
    814</main>
Note: See TracChangeset for help on using the changeset viewer.