Making WordPress.org

Changeset 933


Ignore:
Timestamp:
10/25/2014 04:57:30 AM (12 years ago)
Author:
iandunn
Message:

Add avatars to speaker posts.

props codebykat

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php

    r932 r933  
    4545                add_shortcode( 'organizers', array( $this, 'shortcode_organizers' ) );
    4646                add_shortcode( 'schedule', array( $this, 'shortcode_schedule' ) );
     47
     48                add_filter( 'the_content', array( $this, 'add_avatar_to_speaker_posts' ) );
    4749        }
    4850
    … …  
    10431045                ob_end_clean();
    10441046                return $content;
     1047        }
     1048
     1049        /**
     1050         * Add the speaker's avatar to their post
     1051         *
     1052         * We don't enable it for sites that were created before it was committed, because it may need custom CSS
     1053         * to look good with their custom design, but we allow older sites to opt-in.
     1054         *
     1055         * @param string $content
     1056         *
     1057         * @return string
     1058         */
     1059        public function add_avatar_to_speaker_posts( $content ) {
     1060                global $post;
     1061                $enabled_site_ids = array( 364 );    // 2014.sf
     1062
     1063                if ( 'wcb_speaker' !== $post->post_type ) {
     1064                        return $content;
     1065                }
     1066
     1067                $site_id = get_current_blog_id();
     1068                if ( $site_id <= 463 && ! in_array( $site_id, $enabled_site_ids ) ) {
     1069                        return $content;
     1070                }
     1071
     1072                $avatar = get_avatar( get_post_meta( $post->ID, '_wcb_speaker_email', true ) );
     1073                return '<div class="speaker-avatar">' . $avatar . '</div>' . $content;
    10451074        }
    10461075
Note: See TracChangeset for help on using the changeset viewer.