Making WordPress.org


Ignore:
Timestamp:
07/10/2015 08:32:01 PM (11 years ago)
Author:
iandunn
Message:

WordPress.tv: Give credit to video producers.

Fixes #986
Props BrashRebel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/sidebar-single.php

    r1044 r1724  
    8282                    }
    8383                }
     84
     85            /*
     86             * Credit video producer with link to their WordPress.org profile
     87             *
     88             * In most cases we'll either have the producer name, or the username, but not both.
     89             */
     90            $producer_name     = get_the_terms( get_the_ID(), 'producer' );
     91            $producer_username = get_the_terms( get_the_ID(), 'producer-username' );
    8492            ?>
     93
     94            <?php if ( $producer_name || $producer_username ) : ?>
     95                <h5>Producer</h5>
     96
     97                <div class="video-producer">
     98                    <?php if ( $producer_username ) : ?>
     99
     100                        <a href="<?php echo esc_url( 'https://profiles.wordpress.org/' . rawurlencode( $producer_username[0]->name ) ); ?>">
     101                            <?php if ( $producer_name ) : ?>
     102                                <?php echo esc_html( $producer_name[0]->name ); ?>
     103                            <?php else : ?>
     104                                <?php echo esc_html( $producer_username[0]->name ); ?>
     105                            <?php endif; ?>
     106                        </a>
     107
     108                    <?php else : ?>
     109
     110                        <a href="<?php echo esc_url( get_term_link( $producer_name[0] ) ); ?>">
     111                            <?php echo esc_html( $producer_name[0]->name ); ?>
     112                        </a>
     113
     114                    <?php endif; ?>
     115                </div>
     116            <?php endif; ?>
     117
    85118</div><!-- .secondary-content -->
Note: See TracChangeset for help on using the changeset viewer.