Changeset 12570 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/admin.php
- Timestamp:
- 05/03/2023 11:33:44 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-learn/inc/admin.php
r12276 r12570 6 6 use function WordPressdotorg\Locales\get_locales_with_english_names; 7 7 use function WordPressdotorg\Locales\get_locale_name_from_code; 8 use function WPOrg_Learn\Post_Meta\get_available_ workshop_locales;8 use function WPOrg_Learn\Post_Meta\get_available_post_type_locales; 9 9 10 10 defined( 'WPINC' ) || die(); … … 25 25 } 26 26 add_filter( 'manage_edit-wporg_workshop_sortable_columns', __NAMESPACE__ . '\add_workshop_list_table_sortable_columns' ); 27 add_action( 'restrict_manage_posts', __NAMESPACE__ . '\add_ workshop_list_table_filters', 10, 2 );28 add_action( 'pre_get_posts', __NAMESPACE__ . '\handle_ workshop_list_table_filters' );27 add_action( 'restrict_manage_posts', __NAMESPACE__ . '\add_admin_list_table_filters', 10, 2 ); 28 add_action( 'pre_get_posts', __NAMESPACE__ . '\handle_admin_list_table_filters' ); 29 29 add_filter( 'display_post_states', __NAMESPACE__ . '\add_post_states', 10, 2 ); 30 30 foreach ( array( 'lesson-plan', 'wporg_workshop', 'course', 'lesson' ) as $pt ) { … … 224 224 225 225 /** 226 * Add filtering controls for the workshops list table.226 * Add filtering controls for the tutorial and lesson plan list tables. 227 227 * 228 228 * @param string $post_type … … 231 231 * @return void 232 232 */ 233 function add_workshop_list_table_filters( $post_type, $which ) { 234 if ( 'wporg_workshop' !== $post_type || 'top' !== $which ) { 235 return; 236 } 237 238 $available_locales = get_available_workshop_locales( 'language', 'english', false ); 233 function add_admin_list_table_filters( $post_type, $which ) { 234 if ( ( 'wporg_workshop' !== $post_type && 'lesson-plan' !== $post_type ) || 'top' !== $which ) { 235 return; 236 } 237 238 $post_status = filter_input( INPUT_GET, 'post_status', FILTER_SANITIZE_STRING ); 239 $available_locales = get_available_post_type_locales( 'language', $post_type, $post_status ); 239 240 $language = filter_input( INPUT_GET, 'language', FILTER_SANITIZE_STRING ); 240 241 … … 261 262 262 263 /** 263 * Alter the query to include workshoplist table filters.264 * Alter the query to include tutorial and lesson plan list table filters. 264 265 * 265 266 * @param WP_Query $query … … 267 268 * @return void 268 269 */ 269 function handle_ workshop_list_table_filters( WP_Query $query ) {270 function handle_admin_list_table_filters( WP_Query $query ) { 270 271 if ( ! is_admin() || ! function_exists( 'get_current_screen' ) ) { 271 272 return; … … 278 279 } 279 280 280 if ( 'edit-wporg_workshop' === $current_screen->id ) {281 if ( 'edit-wporg_workshop' === $current_screen->id || 'edit-lesson-plan' === $current_screen->id ) { 281 282 $language = filter_input( INPUT_GET, 'language', FILTER_SANITIZE_STRING ); 282 283
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)