Make WordPress Core

Changeset 25510


Ignore:
Timestamp:
09/19/2013 09:33:00 PM (13 years ago)
Author:
lancewillett
Message:

Twenty Fourteen: first pass at adding a Contributors page template to highlight authors. Props MikeHansenMe, iamtakashi, obenland, and Kuzmanov. See #24863.

Location:
trunk/src/wp-content/themes/twentyfourteen
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfourteen/functions.php

    r25506 r25510  
    341341endif;
    342342
     343if ( ! function_exists( 'twentyfourteen_list_authors' ) ) :
     344/**
     345 * Prints a list of all site contributors who published at least one post.
     346 *
     347 * @return void
     348 */
     349function twentyfourteen_list_authors() {
     350        $contributor_ids = get_users( array(
     351                'fields'  => 'ID',
     352                'orderby' => 'post_count',
     353                'who'     => 'authors',
     354        ) );
     355
     356        foreach ( $contributor_ids as $contributor_id ) :
     357                $post_count = count_user_posts( $contributor_id );
     358
     359                // Move on if user has not published a post (yet).
     360                if ( ! $post_count )
     361                        continue;
     362        ?>
     363
     364        <div class="contributor clear">
     365                <div class="contributor-avatar"><?php echo get_avatar( $contributor_id, 132 ); ?></div>
     366                <div class="contributor-summary">
     367                        <h2 class="contributor-name"><?php echo get_the_author_meta( 'display_name', $contributor_id ); ?></h2>
     368                        <p class="contributor-bio">
     369                                <?php echo get_the_author_meta( 'description', $contributor_id ); ?>
     370                        </p>
     371                        <a class="contributor-posts-link" href="<?php echo esc_url( get_author_posts_url( $contributor_id ) ); ?>">
     372                                <?php printf( _n( '%d Article', '%d Articles', $post_count, 'twentyfourteen' ), $post_count ); ?>
     373                        </a>
     374                </div>
     375        </div><!-- .contributor -->
     376
     377        <?php
     378        endforeach;
     379}
     380endif;
     381
    343382/**
    344383 * Gets recent formatted posts that are not featured in FC plugin.
  • trunk/src/wp-content/themes/twentyfourteen/style.css

    r25506 r25510  
    307307}
    308308button,
     309.contributor-posts-link,
    309310html input[type="button"],
    310311input[type="reset"],
     
    324325}
    325326button:hover,
     327.contributor-posts-link:hover,
    326328html input[type="button"]:hover,
    327329input[type="reset"]:hover,
     
    332334input[type="submit"]:focus {
    333335        background-color: #24890d;
     336        color: #fff;
    334337        cursor: pointer;
    335338}
    336339button:active,
     340.contributor-posts-link:active,
    337341html input[type="button"]:active,
    338342input[type="reset"]:active,
     
    496500/* Genericons */
    497501.search-toggle:before,
     502.contributor-posts-link:before,
    498503.widget_twentyfourteen_ephemera .widget-title:before {
    499504        display: inline-block;
     
    17271732        margin: 2.4rem 0 0;
    17281733}
     1734
    17291735.post-navigation [rel="prev"],
    17301736.post-navigation [rel="next"],
     
    23152321}
    23162322
     2323
     2324/* =Contributor Page
     2325----------------------------------------------- */
     2326
     2327.contributor {
     2328        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
     2329        -moz-box-sizing: border-box;
     2330        box-sizing:      border-box;
     2331        padding: 48px 0;
     2332        padding: 4.8rem 0;
     2333}
     2334.contributor-avatar {
     2335        float: left;
     2336        padding: 2px;
     2337        padding: 0.2rem;
     2338        border: 1px solid rgba(0, 0, 0, 0.1);
     2339        margin-right: 30px;
     2340        margin-right: 3.0rem;
     2341}
     2342.contributor-avatar .avatar {
     2343        vertical-align: middle;
     2344}
     2345.contributor-summary {
     2346        float: left;
     2347        max-width: 474px;
     2348        max-width: 47.4rem;
     2349        width: -webkit-calc(100% - 164px);
     2350        width:         calc(100% - 164px);
     2351}
     2352.contributor-name {
     2353        font-size: 16px;
     2354        font-size: 1.6rem;
     2355        font-weight: 900;
     2356        line-height: 1.5;
     2357        margin-bottom: 0;
     2358        text-transform: uppercase;
     2359}
     2360.contributor-bio {
     2361        color: #767676;
     2362}
     2363.contributor-posts-link {
     2364        display: inline-block;
     2365}
     2366.contributor-posts-link:before {
     2367        content: '\f443';
     2368        vertical-align: text-bottom;
     2369}
     2370
     2371
    23172372/* =Media Queries
    23182373----------------------------------------------- */
     
    23982453                content: '';
    23992454        }
     2455
    24002456        .content-area .featured-post:before,
    24012457        .content-area .post-format a:before,
     
    24152471                margin: 0 0.2rem 0 0;
    24162472                text-transform: none;
    2417                 vertical-align: top;
    24182473        }
    24192474        .content-area .entry-meta > span {
     
    26902745                margin: 0 8.03571428% 0 12.5%;
    26912746        }
     2747        .contributor,
    26922748        .content-area .full-width .entry-header,
    26932749        .content-area .full-width .entry-content,
     
    29082964                padding: 0 0 1.2rem;
    29092965        }
     2966        .contributor,
    29102967        .content-area .full-width .entry-header,
    29112968        .content-area .full-width .entry-content,
     
    30293086                margin: 0 8.03571428% 0 12.5%;
    30303087        }
     3088        .contributor,
    30313089        .content-area .full-width .entry-header,
    30323090        .content-area .full-width .entry-content,
     
    30693127                padding-right: 0;
    30703128        }
     3129        .contributor,
    30713130        .content-area .full-width .entry-header,
    30723131        .content-area .full-width .entry-content,
Note: See TracChangeset for help on using the changeset viewer.