Changeset 10528 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/functions.php
- Timestamp:
- 12/17/2020 12:13:25 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/functions.php
r10515 r10528 18 18 19 19 global $woothemes_sensei; 20 remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ) ); 21 remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ) ); 20 if ( $woothemes_sensei ) { 21 remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ) ); 22 remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ) ); 23 } 22 24 23 25 // The parent wporg theme is designed for use on wordpress.org/* and assumes locale-domains are available. … … 241 243 } 242 244 243 $valid_post_types = array( 'lesson-plan', 'wporg_workshop' );245 $valid_post_types = array( 'lesson-plan', 'wporg_workshop', 'course' ); 244 246 245 247 if ( $query->is_main_query() && $query->is_post_type_archive( $valid_post_types ) ) { 246 248 wporg_archive_maybe_apply_query_filters( $query ); 247 249 248 if ( $query->is_post_type_archive( 'wporg_workshop' ) && true !== $query->get( 'wporg_ workshop_filters' ) ) {250 if ( $query->is_post_type_archive( 'wporg_workshop' ) && true !== $query->get( 'wporg_archive_filters' ) ) { 249 251 $featured = wporg_get_featured_workshops(); 250 252 … … 300 302 INPUT_GET, 301 303 array( 302 'se ries' => FILTER_SANITIZE_NUMBER_INT,303 ' topic' => FILTER_SANITIZE_NUMBER_INT,304 'search' => FILTER_SANITIZE_STRING, 305 'captions' => FILTER_SANITIZE_STRING, 304 306 'language' => FILTER_SANITIZE_STRING, 305 'captions' => FILTER_SANITIZE_STRING, 306 'search' => FILTER_SANITIZE_STRING, 307 'audience' => array( 308 'filter' => FILTER_VALIDATE_INT, 309 'flags' => FILTER_REQUIRE_ARRAY, 310 ), 311 'duration' => array( 312 'filter' => FILTER_VALIDATE_INT, 313 'flags' => FILTER_REQUIRE_ARRAY, 314 ), 315 'level' => array( 316 'filter' => FILTER_VALIDATE_INT, 317 'flags' => FILTER_REQUIRE_ARRAY, 318 ), 319 'series' => FILTER_VALIDATE_INT, 320 'topic' => FILTER_VALIDATE_INT, 321 'type' => array( 322 'filter' => FILTER_VALIDATE_INT, 323 'flags' => FILTER_REQUIRE_ARRAY, 324 ), 307 325 ), 308 326 false 327 ); 328 329 $entity_map = array( 330 'captions' => 'video_caption_language', 331 'language' => 'video_language', 332 'audience' => 'audience', 333 'duration' => 'duration', 334 'level' => 'level', 335 'series' => 'wporg_workshop_series', 336 'topic' => 'topic', 337 'type' => 'instruction_type', 309 338 ); 310 339 … … 318 347 foreach ( $filters as $filter_name => $filter_value ) { 319 348 switch ( $filter_name ) { 320 case 'series': 321 if ( ! empty( $tax_query ) ) { 322 $tax_query['relation'] = 'AND'; 323 } 324 $tax_query[] = array( 325 'taxonomy' => 'wporg_workshop_series', 326 'terms' => $filter_value, 327 ); 349 case 'search': 350 $query->set( 's', $filter_value ); 351 $is_filtered = true; 328 352 break; 329 case 'topic': 330 if ( ! empty( $tax_query ) ) { 331 $tax_query['relation'] = 'AND'; 332 } 333 $tax_query[] = array( 334 'taxonomy' => 'topic', 335 'terms' => $filter_value, 336 ); 337 break; 353 case 'captions': 338 354 case 'language': 339 355 if ( ! empty( $meta_query ) ) { … … 341 357 } 342 358 $meta_query[] = array( 343 'key' => 'video_language',359 'key' => $entity_map[ $filter_name ], 344 360 'value' => $filter_value, 345 361 ); 346 362 break; 347 case 'captions': 348 if ( ! empty( $meta_query ) ) { 349 $meta_query['relation'] = 'AND'; 363 case 'audience': 364 case 'duration': 365 case 'level': 366 case 'series': 367 case 'topic': 368 case 'type': 369 if ( ! empty( $tax_query ) ) { 370 $tax_query['relation'] = 'AND'; 350 371 } 351 $ meta_query[] = array(352 ' key' => 'video_caption_language',353 ' value'=> $filter_value,372 $tax_query[] = array( 373 'taxonomy' => $entity_map[ $filter_name ], 374 'terms' => $filter_value, 354 375 ); 355 break;356 case 'search':357 $query->set( 's', $filter_value );358 $is_filtered = true;359 376 break; 360 377 } … … 373 390 374 391 if ( $is_filtered ) { 375 $query->set( 'wporg_ workshop_filters', true );392 $query->set( 'wporg_archive_filters', true ); 376 393 } 377 394 }
Note: See TracChangeset
for help on using the changeset viewer.