Ticket #2850: 2850.2.diff
File 2850.2.diff, 4.3 KB (added by , 8 years ago) |
---|
-
wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php
diff --git wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php index efbd160..3dc7a0b 100644
class WordCamp_Post_Types_Plugin { 281 281 'order' => 'desc', 282 282 'track' => '', 283 283 'speaker_link' => '', 284 'groups' => '', 284 285 ), $attr ); 285 286 286 287 foreach ( array( 'orderby', 'order', 'track', 'speaker_link' ) as $key_for_case_sensitive_value ) { … … class WordCamp_Post_Types_Plugin { 292 293 $attr['order'] = in_array( $attr['order'], array( 'asc', 'desc' ) ) ? $attr['order'] : 'desc'; 293 294 $attr['speaker_link'] = in_array( $attr['speaker_link'], array( 'permalink' ) ) ? $attr['speaker_link'] : ''; 294 295 $attr['track'] = array_map( 'trim', explode( ',', $attr['track'] ) ); 296 $attr['groups'] = array_map( 'trim', explode( ',', $attr['groups'] ) ); 295 297 296 298 // Fetch all the relevant sessions 297 299 $session_args = array( … … class WordCamp_Post_Types_Plugin { 347 349 $speaker_args['post__in'] = $speaker_ids; 348 350 } 349 351 352 if ( ! empty( $attr['groups'] ) ) { 353 $speaker_args['tax_query'] = array( 354 array( 355 'taxonomy' => 'wcb_speaker_group', 356 'field' => 'slug', 357 'terms' => $attr['groups'], 358 ), 359 ); 360 } 361 350 362 $speakers = new WP_Query( $speaker_args ); 351 363 352 364 if ( ! $speakers->have_posts() ) … … class WordCamp_Post_Types_Plugin { 861 873 /** 862 874 * The [sessions] shortcode handler 863 875 */ 876 864 877 function shortcode_sessions( $attr, $content ) { 865 878 global $post; 866 879 … … class WordCamp_Post_Types_Plugin { 1384 1397 ) 1385 1398 ); 1386 1399 1387 $sessions_html .= '<ul id="speaker-session-names">';1388 1400 while ( $sessions->have_posts() ) { 1389 1401 $sessions->the_post(); 1390 $sessions_html .= sprintf( '<li><a href="%s">%s</a></li>', get_the_permalink(), get_the_title() ); 1402 1403 $links = array(); 1404 1405 if ( $url = get_post_meta( get_the_ID(), '_wcpt_session_slides', true ) ) { 1406 $links['slides'] = array( 1407 'url' => $url, 1408 'label' => __( 'Slides', 'wordcamporg' ), 1409 ); 1410 } 1411 1412 if ( $url = get_post_meta( get_the_ID(), '_wcpt_session_video', true ) ) { 1413 $links['video'] = array( 1414 'url' => $url, 1415 'label' => __( 'Video', 'wordcamporg' ), 1416 ); 1417 } 1418 1419 $sessions_html .= sprintf( '<div id="wcorg-session-%s" class="wcorg-session">', absint( get_the_ID() ) ); 1420 $sessions_html .= sprintf( '<h3 class="wcorg-session-title"><a href="%s">%s</a></h3>', esc_url( get_permalink() ), esc_html( get_the_title() ) ); 1421 $sessions_html .= '<div class="wcorg-session-description">'; 1422 $sessions_html .= get_the_excerpt(); 1423 1424 if ( $links ) { 1425 $sessions_html .= '<ul class="wcorg-session-links">'; 1426 1427 foreach ( $links as $link ) { 1428 $sessions_html .= sprintf( 1429 '<li> 1430 <a href="%s">%s</a> 1431 </li>', 1432 esc_url( $link['url'] ), 1433 esc_html( $link['label'] ) 1434 ); 1435 } 1436 1437 $sessions_html .= '</ul>'; 1438 } 1439 1440 $sessions_html .= '</div></div>'; 1441 1391 1442 } 1392 $sessions_html .= '</ul>';1393 1443 1394 1444 wp_reset_postdata(); 1395 1445 … … class WordCamp_Post_Types_Plugin { 2056 2106 'show_ui' => true, 2057 2107 ) 2058 2108 ); 2109 2110 // Labels for speaker groups. 2111 $labels = array( 2112 'name' => __( 'Groups', 'wordcamporg' ), 2113 'singular_name' => __( 'Group', 'wordcamporg' ), 2114 'search_items' => __( 'Search Groups', 'wordcamporg' ), 2115 'popular_items' => __( 'Popular Groups', 'wordcamporg' ), 2116 'all_items' => __( 'All Groups', 'wordcamporg' ), 2117 'edit_item' => __( 'Edit Group', 'wordcamporg' ), 2118 'update_item' => __( 'Update Group', 'wordcamporg' ), 2119 'add_new_item' => __( 'Add Group', 'wordcamporg' ), 2120 'new_item_name' => __( 'New Group', 'wordcamporg' ), 2121 ); 2122 2123 // Register speaker groups taxonomy 2124 register_taxonomy( 2125 'wcb_speaker_group', 2126 'wcb_speaker', 2127 array( 2128 'labels' => $labels, 2129 'rewrite' => array( 'slug' => 'speaker-group' ), 2130 'query_var' => 'group', 2131 'hierarchical' => true, 2132 'public' => true, 2133 'show_ui' => true, 2134 ) 2135 ); 2059 2136 } 2060 2137 2061 2138 /**