Changeset 11323 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/functions.php
- Timestamp:
- 11/11/2021 03:53:36 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-learn-2020/functions.php
r11279 r11323 276 276 array( 277 277 'post_date' => 'DESC', 278 'ID' => 'ASC',278 'ID' => 'ASC', 279 279 ) 280 280 ); … … 360 360 * grouping, there would be a separate row for each postmeta value for each workshop post. 361 361 */ 362 $clauses['fields'] 362 $clauses['fields'] .= ", 363 363 MAX( IF( pmeta.meta_key = 'video_language' AND pmeta.meta_value LIKE '{$locale_root}%', 1, 0 ) ) AS has_language 364 364 "; 365 $clauses['fields'] 365 $clauses['fields'] .= ", 366 366 MAX( IF( pmeta.meta_key = 'video_caption_language' AND pmeta.meta_value LIKE '{$locale_root}%', 1, 0 ) ) AS has_caption 367 367 "; 368 $clauses['join'] 368 $clauses['join'] .= " INNER JOIN {$wpdb->postmeta} pmeta ON ( {$wpdb->posts}.ID = pmeta.post_id )"; 369 369 // This orderby clause ensures that the workshops are sorted by the values in the calculated columns first. 370 370 $clauses['orderby'] = 'has_language DESC, has_caption DESC, ' . $clauses['orderby']; … … 432 432 $meta_query = array(); 433 433 $tax_query = array(); 434 434 435 $is_filtered = false; 435 436 … … 512 513 */ 513 514 function wporg_get_archive_query( $post_type, array $args = array() ) { 514 $args = wp_parse_args( $args, array( 515 'post_type' => $post_type, 516 'post_status' => 'publish', 517 ) ); 515 $args = wp_parse_args( 516 $args, 517 array( 518 'post_type' => $post_type, 519 'post_status' => 'publish', 520 ) 521 ); 518 522 519 523 return new WP_Query( $args ); … … 528 532 */ 529 533 function wporg_learn_get_card_template_args( $post_id ) { 530 $post = get_post( $post_id );534 $post = get_post( $post_id ); 531 535 $post_type = get_post_type( $post ); 532 536 … … 549 553 550 554 if ( is_user_logged_in() ) { 551 $completed 555 $completed = count( Sensei()->course->get_completed_lesson_ids( $post_id, get_current_user_id() ) ); 552 556 553 557 $args['meta'][] = array( … … 924 928 925 929 /** 930 * Register theme sidebars. 931 */ 932 function wporg_learn_register_sidebars() { 933 // Register lesson plans sidebar. 934 register_sidebar( 935 array( 936 'name' => __( 'Lesson Plans', 'wporg-learn' ), 937 'id' => 'wporg-learn-lesson-plans', 938 'before_widget' => '<div id="%1$s" class="block-widgets %2$s">', 939 'after_widget' => '</div>', 940 'before_title' => '<h4 class="widget-title">', 941 'after_title' => '<h4>', 942 ) 943 ); 944 945 // Register courses sidebar. 946 register_sidebar( 947 array( 948 'name' => __( 'Courses', 'wporg-learn' ), 949 'id' => 'wporg-learn-courses', 950 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 951 'after_widget' => '</aside>', 952 'before_title' => '<h4 class="widget-title">', 953 'after_title' => '</h4>', 954 ) 955 ); 956 957 // Register workshops sidebar. 958 register_sidebar( 959 array( 960 'name' => __( 'Workshops', 'wporg-learn' ), 961 'id' => 'wporg-learn-workshops', 962 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 963 'after_widget' => '</aside>', 964 'before_title' => '<h4 class="widget-title">', 965 'after_title' => '</h4>', 966 ) 967 ); 968 } 969 add_filter( 'widgets_init', 'wporg_learn_register_sidebars', 10 ); 970 971 /** 926 972 * Add fallback image to Jetpack when no featured image exists. 927 973 * … … 934 980 } 935 981 add_action( 'jetpack_open_graph_image_default', 'wporg_learn_return_default_image', 15, 1 ); 982 983 /** 984 * Disable the News XML Sitemap generated by Jetpack 985 */ 986 add_filter( 'jetpack_news_sitemap_generate', '__return_false' );
Note: See TracChangeset
for help on using the changeset viewer.