Changeset 235
- Timestamp:
- 01/08/2014 07:16:11 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php
r172 r235 26 26 add_action( 'save_post', array( $this, 'save_post_session' ), 10, 2 ); 27 27 add_action( 'save_post', array( $this, 'save_post_organizer' ), 10, 2); 28 add_action( 'save_post', array( $this, 'save_post_sponsor' ), 10, 2); 28 29 29 30 add_filter( 'manage_wcb_speaker_posts_columns', array( $this, 'manage_post_types_columns' ) ); … … 869 870 870 871 $attr = shortcode_atts( array( 871 872 'link' => 'none' 872 873 ), $attr ); 873 874 … … 896 897 897 898 <?php while ( $sponsors->have_posts() ) : $sponsors->the_post(); ?> 899 <?php $website = get_post_meta( get_the_ID(), '_wcpt_sponsor_website', true ); ?> 900 898 901 <div id="wcorg-sponsor-<?php the_ID(); ?>" class="wcorg-sponsor"> 899 <h3><?php the_title(); ?></h3> 902 <?php if ( 'website' == $attr['link'] && $website ) : ?> 903 <h3><a href="<?php echo esc_attr( esc_url( $website ) ); ?>"><?php the_title(); ?></a></h3> 904 <?php else : ?> 905 <h3><?php the_title(); ?></h3> 906 <?php endif; ?> 907 900 908 <div class="wcorg-sponsor-description"> 901 <?php the_post_thumbnail(); ?> 909 <?php if ( 'website' == $attr['link'] && $website ) : ?> 910 <a href="<?php echo esc_attr( esc_url( $website ) ); ?>"><?php the_post_thumbnail(); ?></a> 911 <?php else : ?> 912 <?php the_post_thumbnail(); ?> 913 <?php endif; ?> 914 902 915 <?php the_content(); ?> 903 916 </div> … … 925 938 add_meta_box( 'speakers-list', __( 'Speakers', $this->textdomain ), array( $this, 'metabox_speakers_list' ), 'wcb_session', 'side' ); 926 939 add_meta_box( 'session-info', __( 'Session Info', $this->textdomain ), array( $this, 'metabox_session_info' ), 'wcb_session', 'side' ); 940 add_meta_box( 'sponsor-info', __( 'Sponsor Info', 'wordcampbase' ), array( $this, 'metabox_sponsor_info' ), 'wcb_sponsor', 'side' ); 927 941 } 928 942 … … 1065 1079 1066 1080 /** 1081 * Render the Sponsor Info metabox view 1082 */ 1083 function metabox_sponsor_info( $sponsor ) { 1084 $website = get_post_meta( $sponsor->ID, '_wcpt_sponsor_website', true ); 1085 wp_nonce_field( 'edit-sponsor-info', 'wcpt-meta-sponsor-info' ); 1086 1087 ?> 1088 1089 <p> 1090 <label for="_wcpt_sponsor_websitee"><?php _e( 'Website:', 'wordcampbase' ); ?></label> 1091 <input type="text" class="widefat" id="_wcpt_sponsor_website" name="_wcpt_sponsor_website" value="<?php echo esc_attr( esc_url( $website ) ); ?>" /> 1092 </p> 1093 1094 <?php 1095 } 1096 1097 /** 1067 1098 * Fired when a post is saved, makes sure additional metadata is also updated. 1068 1099 */ … … 1194 1225 1195 1226 /** 1227 * Save meta data for Sponsor posts 1228 */ 1229 function save_post_sponsor( $post_id, $post ) { 1230 if ( wp_is_post_revision( $post_id ) || $post->post_type != 'wcb_sponsor' || ! current_user_can( 'edit_post', $post_id ) ) { 1231 return; 1232 } 1233 1234 if ( isset( $_POST['wcpt-meta-sponsor-info'] ) && wp_verify_nonce( $_POST['wcpt-meta-sponsor-info'], 'edit-sponsor-info' ) ) { 1235 $website = esc_url_raw( $_POST['_wcpt_sponsor_website'] ); 1236 1237 // TODO: maybe only allows links to home page, depending on outcome of http://make.wordpress.org/community/2013/12/31/irs-rules-for-corporate-sponsorship-of-wordcamp/ 1238 1239 if ( $website ) { 1240 update_post_meta( $post_id, '_wcpt_sponsor_website', $website ); 1241 } else { 1242 delete_post_meta( $post_id, '_wcpt_sponsor_website' ); 1243 } 1244 } 1245 } 1246 1247 /** 1196 1248 * Registers the custom post types, runs during init. 1197 1249 */
Note: See TracChangeset
for help on using the changeset viewer.