Changeset 13834 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/functions.php
- Timestamp:
- 06/19/2024 01:43:38 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/functions.php
r13833 r13834 12 12 require_once __DIR__ . '/src/sensei-meta-list/index.php'; 13 13 require_once __DIR__ . '/inc/block-config.php'; 14 require_once __DIR__ . '/inc/query.php'; 14 15 15 16 /** … … 30 31 return $args; 31 32 } ); 32 add_action( 'pre_get_posts', __NAMESPACE__ . '\modify_learning_pathways_query' );33 33 34 34 /** … … 280 280 return $breadcrumbs; 281 281 } 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_Query289 */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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)