Ticket #1084: wc-post-types-wceu.diff
File wc-post-types-wceu.diff, 3.8 KB (added by , 9 years ago) |
---|
-
inc/back-compat.php
66 66 function shortcode_speakers( $attr, $content ) { 67 67 global $post; 68 68 69 $attr = shortcode_atts( array( 70 'speaker_link' => '', 71 ), $attr ); 72 73 $attr['speaker_link'] = in_array( $attr['speaker_link'], array( 'permalink' ) ) ? $attr['speaker_link'] : ''; 74 69 75 $speakers = new WP_Query( array( 70 76 'post_type' => 'wcb_speaker', 71 77 'orderby' => 'title', … … 81 87 82 88 <div class="cpt-loop speaker-gravatar-list clearfix"> 83 89 <p> 84 <?php while ( $speakers->have_posts() ) : $speakers->the_post(); ?>85 <?php86 $href = '#' . esc_attr( $post->post_name );90 <?php while ( $speakers->have_posts() ) : 91 $speakers->the_post(); 92 $href = $attr['speaker_link'] ? get_the_permalink() : '#' . esc_attr( $post->post_name ); 87 93 $title = esc_attr( get_the_title() ); 88 94 echo "<a href='$href' title='$title'>"; 89 95 echo get_avatar( get_post_meta( get_the_ID(), '_wcb_speaker_email', true ), 48 ); … … 107 113 echo '</div><div class="grid_6 omega">'; 108 114 109 115 $odd = ( ( $speakers->current_post + 1 ) % 2 ) ? 'odd' : 'even'; 116 117 $speaker_title = get_the_title(); 118 if ( $attr['speaker_link'] === 'permalink' ) { 119 $speaker_title = '<a href="' . get_the_permalink() . '">' . get_the_title() . '</a>'; 120 } 110 121 ?> 111 122 112 123 <div id="<?php echo esc_attr( $post->post_name ); ?>" <?php post_class( 'speaker clearfix ' . $odd ); ?> > 113 <h3 class="entry-title speaker-name"><?php the_title(); ?></h3>124 <h3 class="entry-title speaker-name"><?php echo $speaker_title; ?></h3> 114 125 <div class="entry-content speaker-bio"> 115 126 <?php 116 127 echo get_avatar( get_post_meta( get_the_ID(), '_wcb_speaker_email', true ), 102 ); -
wc-post-types.php
66 66 function admin_init() { 67 67 register_setting( 'wcb_sponsor_options', 'wcb_sponsor_level_order', array( $this, 'validate_sponsor_options' ) ); 68 68 add_action( 'pre_get_posts', array( $this, 'admin_pre_get_posts' ) ); 69 $this->speakers_comments_settings(); 69 70 } 70 71 71 72 /** … … 1712 1713 register_post_type( 'wcb_speaker', array( 1713 1714 'labels' => $labels, 1714 1715 'rewrite' => array( 'slug' => 'speaker', 'with_front' => true ), 1715 'supports' => array( 'title', 'editor', 'revisions'),1716 'supports' => $this->get_supports(), 1716 1717 'menu_position' => 20, 1717 1718 'public' => true, 1718 1719 'show_ui' => true, … … 2033 2034 2034 2035 return $items; 2035 2036 } 2037 2038 function speakers_comments_settings() { 2039 add_settings_section( 2040 'speakers_comments_section', 2041 'Allow comments for speakers', 2042 array( $this, 'speakers_comments_section_callback' ), 2043 'discussion' 2044 ); 2045 2046 add_settings_field( 2047 'speakers_comments_allowed', 2048 'Speaker comments allowed', 2049 array( $this, 'speakers_comments_allowed_callback' ), 2050 'discussion', 2051 'speakers_comments_section' 2052 ); 2053 2054 register_setting( 'discussion', 'speakers_comments_allowed' ); 2055 } 2056 2057 function speakers_comments_section_callback() { 2058 echo '<p>You can enable comments for Speakers to allow users provide feedback for the talks.</p>'; 2059 } 2060 2061 function speakers_comments_allowed_callback() { 2062 echo '<input name="speakers_comments_allowed" id="speakers_comments_allowed" type="checkbox" value="1" class="code" ' . checked( 1, get_option( 'speakers_comments_allowed' ), false ) . ' />'; 2063 } 2064 2065 function get_supports() { 2066 $supports = array( 'title', 'editor', 'revisions' ); 2067 if ( get_option( 'speakers_comments_allowed' ) ) { 2068 $supports[] = 'comments'; 2069 } 2070 return $supports; 2071 } 2036 2072 } 2037 2073 2038 2074 // Load the plugin class.