Making WordPress.org


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

Learn: Sync with git WordPress/learn@81fefad

File:
1 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 }
Note: See TracChangeset for help on using the changeset viewer.