Changeset 13833 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2024/functions.php
- Timestamp:
- 06/18/2024 11:34:53 PM (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
r13810 r13833 7 7 // Block files 8 8 require_once __DIR__ . '/src/learning-pathway-cards/index.php'; 9 require_once __DIR__ . '/src/learning-pathway-header/index.php'; 9 10 require_once __DIR__ . '/src/search-results-context/index.php'; 10 11 require_once __DIR__ . '/src/upcoming-online-workshops/index.php'; … … 29 30 return $args; 30 31 } ); 32 add_action( 'pre_get_posts', __NAMESPACE__ . '\modify_learning_pathways_query' ); 31 33 32 34 /** … … 278 280 return $breadcrumbs; 279 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_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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)