Make WordPress Core

Changeset 25735


Ignore:
Timestamp:
10/08/2013 09:21:19 PM (13 years ago)
Author:
lancewillett
Message:

Twenty Fourteen: allow pages to have featured images, props iamtakashi. Fixes #25325.

Location:
trunk/src/wp-content/themes/twentyfourteen
Files:
11 edited

Legend:

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

    r25088 r25735  
    99
    1010<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     11        <?php twentyfourteen_featured_thumbnail(); ?>
     12
    1113        <header class="entry-header">
    1214                <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
  • trunk/src/wp-content/themes/twentyfourteen/content-image.php

    r25088 r25735  
    99
    1010<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     11        <?php twentyfourteen_featured_thumbnail(); ?>
     12
    1113        <header class="entry-header">
    1214                <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
  • trunk/src/wp-content/themes/twentyfourteen/content-link.php

    r25088 r25735  
    99
    1010<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     11        <?php twentyfourteen_featured_thumbnail(); ?>
     12
    1113        <header class="entry-header">
    1214                <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
  • trunk/src/wp-content/themes/twentyfourteen/content-page.php

    r25021 r25735  
    99
    1010<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     11        <?php twentyfourteen_featured_thumbnail(); ?>
     12
    1113        <?php the_title( '<header class="entry-header"><h1 class="entry-title">', '</h1></header><!-- .entry-header -->' ); ?>
    1214
  • trunk/src/wp-content/themes/twentyfourteen/content-quote.php

    r25088 r25735  
    99
    1010<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     11        <?php twentyfourteen_featured_thumbnail(); ?>
     12
    1113        <header class="entry-header">
    1214                <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
  • trunk/src/wp-content/themes/twentyfourteen/content-video.php

    r25088 r25735  
    99
    1010<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     11        <?php twentyfourteen_featured_thumbnail(); ?>
     12
    1113        <header class="entry-header">
    1214                <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
  • trunk/src/wp-content/themes/twentyfourteen/content.php

    r25088 r25735  
    44 * @subpackage Twenty_Fourteen
    55 */
    6 
    76?>
    87
    98<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    10         <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentyfourteen' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="<?php the_ID(); ?>" class="attachment-featured-thumbnail">
    11                 <?php the_post_thumbnail( 'featured-thumbnail-large' ); ?>
    12         </a>
     9        <?php twentyfourteen_featured_thumbnail(); ?>
    1310
    1411        <header class="entry-header">
  • trunk/src/wp-content/themes/twentyfourteen/functions.php

    r25624 r25735  
    6060
    6161        // Enable support for Post Thumbnails.
    62         add_theme_support( 'post-thumbnails', array( 'post' ) );
     62        add_theme_support( 'post-thumbnails' );
    6363
    6464        // Adding several sizes for Post Thumbnails.
    … …  
    482482
    483483/**
     484 * Extends the default WordPress post classes.
     485 *
     486 * Adds a post class to denote:
     487 * Non-password protected page with a featured image.
     488 *
     489 * @param array $classes A list of existing post class values.
     490 * @return array The filtered post class list.
     491 */
     492function twentyfourteen_post_classes( $classes ) {
     493        if ( ! post_password_required() && has_post_thumbnail() )
     494                $classes[] = 'has-featured-image';
     495
     496        return $classes;
     497}
     498add_filter( 'post_class', 'twentyfourteen_post_classes' );
     499
     500/**
    484501 * Creates a nicely formatted and more specific title element text for output
    485502 * in head of document, based on current view.
  • trunk/src/wp-content/themes/twentyfourteen/inc/template-tags.php

    r25088 r25735  
    144144add_action( 'edit_category', 'twentyfourteen_category_transient_flusher' );
    145145add_action( 'save_post',     'twentyfourteen_category_transient_flusher' );
     146
     147/**
     148 * Displays featured image with appropriate html tag.
     149 *
     150 * @return void
     151 */
     152function twentyfourteen_featured_thumbnail() {
     153        if ( ! post_password_required() ) :
     154                if ( has_post_thumbnail() && is_singular() ) :
     155                ?>
     156                        <div class="attachment-featured-thumbnail">
     157                                <?php the_post_thumbnail( 'featured-thumbnail-large' ); ?>
     158                        </div>
     159                <?php
     160                else :
     161                ?>
     162                        <a href="<?php the_permalink(); ?>" rel="<?php the_ID(); ?>" class="attachment-featured-thumbnail">
     163                                <?php the_post_thumbnail( 'featured-thumbnail-large' ); ?>
     164                        </a>
     165                <?php
     166                endif;
     167        endif;
     168}
  • trunk/src/wp-content/themes/twentyfourteen/js/theme.js

    r25731 r25735  
    129129                }
    130130        );
    131        
     131
    132132} )( jQuery );
  • trunk/src/wp-content/themes/twentyfourteen/style.css

    r25731 r25735  
    454454.clear:before,
    455455.clear:after,
     456.hentry:before,
     457.hentry:after,
    456458[class*="content"]:before,
    457459[class*="content"]:after,
    … …  
    463465
    464466.clear:after,
     467.hentry:after,
    465468[class*="content"]:after,
    466469[class*="site"]:after {
    … …  
    717720.primary-navigation ul li:hover > ul,
    718721.primary-navigation ul li.a11y-focus > ul {
    719         left: auto;     
     722        left: auto;
    720723}
    721724.primary-navigation ul ul li:hover > ul,
    … …  
    818821        background-image:         linear-gradient(135deg, #767676 12.5%, #fff 12.5%, #fff 50%, #767676 50%, #767676 62.5%, #fff 62.5%);
    819822        background-size: 4px 4px;
    820         display: block;
     823        display: none;
    821824        float: none;
    822825        margin: 0;
    … …  
    827830        z-index: 0;
    828831}
     832.has-featured-image .attachment-featured-thumbnail,
     833.format-standard .attachment-featured-thumbnail {
     834        display: block;
     835}
    829836.attachment-featured-thumbnail:hover {
    830837        background: #919191;
    … …  
    834841        background-size: 4px 4px;
    835842}
    836 .full-width .attachment-featured-thumbnail img {
     843.attachment-featured-thumbnail img {
    837844        display: block;
    838845        margin: 0 auto;
    … …  
    949956.content-area .entry-header,
    950957.content-area .entry-content,
    951 .content-area .page-content,
    952958.content-area .entry-summary,
    953 .content-area .entry-meta {
     959.content-area .entry-meta,
     960.page-content {
    954961        margin: 0 auto;
    955962        max-width: 474px;
    … …  
    957964.content-area .entry-header {
    958965        background-color: #fff;
    959         padding: 24px 10px 12px;
     966        padding: 0 10px 12px;
     967}
     968.content-area .has-featured-image .entry-header,
     969.content-area .format-standard .entry-header {
     970        padding-top: 24px;
     971}
     972.content-area .format-standard.post-password-required .entry-header {
     973        padding-top: 0;
    960974}
    961975.content-area .entry-title {
    … …  
    972986}
    973987.content-area .entry-content,
    974 .content-area .page-content,
    975 .content-area .entry-summary {
     988.content-area .entry-summary,
     989.page-content {
    976990        background-color: #fff;
    977991        padding: 12px 10px 0;
    … …  
    982996}
    983997.content-area footer.entry-meta {
    984         margin-bottom: 36px;
     998        margin-bottom: 24px;
    985999}
    9861000.content-area footer.entry-meta .entry-title {
    … …  
    9961010footer.entry-meta .entry-title a:hover {
    9971011        color: #2b2b2b;
    998 }
    999 .format-aside,
    1000 .format-quote,
    1001 .format-link,
    1002 .format-image,
    1003 .format-video {
    1004         border-top: 1px solid rgba(0, 0, 0, 0.1);
    10051012}
    10061013.format-aside .entry-content,
    … …  
    10121019        padding-top: 0;
    10131020}
    1014 
    1015 /* Single specific styles */
    1016 .single .format-aside .entry-header,
    1017 .single .format-quote .entry-header,
    1018 .single .format-link .entry-header,
    1019 .single .format-image .entry-header,
    1020 .single .format-video .entry-header {
    1021         padding-top: 0;
    1022 }
    1023 .single .format-aside,
    1024 .single .format-quote,
    1025 .single .format-link,
    1026 .single .format-image,
    1027 .single .format-video {
    1028         border-top: none;
    1029 }
    1030 
    10311021/* Page specific styles */
    10321022.page .entry-content,
    … …  
    11601150        font-weight: 900;
    11611151        line-height: 1.5;
    1162         margin-bottom: 24px;
     1152        margin: 0 0 24px;
    11631153}
    11641154.taxonomy-description {
    … …  
    15871577.post-navigation,
    15881578.image-navigation {
    1589         margin: 24px auto;
     1579        margin: 24px auto 48px;
    15901580        max-width: 474px;
    15911581        padding: 0 10px;
    … …  
    16561646
    16571647.comments-area {
    1658         margin: 36px auto;
     1648        margin: 48px auto;
    16591649        max-width: 474px;
    16601650        padding: 0 10px;
    … …  
    22092199                text-transform: none;
    22102200        }
    2211         .list-view .content-area .format-aside,
    2212         .list-view .content-area .format-quote,
    2213         .list-view .content-area .format-link,
    2214         .list-view .content-area .format-image,
    2215         .list-view .content-area .format-video {
    2216                 border-top: 0;
    2217         }
    22182201        .list-view .content-area .format-aside .entry-title,
    22192202        .list-view .content-area .format-quote .entry-title,
    … …  
    22332216
    22342217@media screen and (min-width: 401px) {
    2235         .attachment-featured-thumbnail:hover img {
     2218        a.attachment-featured-thumbnail:hover img {
    22362219                opacity: 0.85;
    22372220        }
    … …  
    23162299                padding: 0 10px;
    23172300        }
    2318         .search-results .content-area .type-page {
     2301        .list-view .content-area .hentry {
    23192302                border-top: 1px solid rgba(0, 0, 0, 0.1);
    2320         }
    2321         .search-results .content-area .type-page .entry-header {
    2322                 margin-top: 24px;
     2303                padding-top: 48px;
     2304        }
     2305        .list-view .content-area .has-featured-image .attachment-featured-thumbnail,
     2306        .list-view .content-area .format-standard .attachment-featured-thumbnail {
     2307                margin-top: -49px;
    23232308        }
    23242309}
    … …  
    23262311@media screen and (min-width: 642px) {
    23272312        .content-area .entry-header {
    2328                 margin-top: -48px;
    23292313                padding-right: 30px;
    23302314                padding-left: 30px;
    23312315        }
    2332         .attachment .content-area .entry-header {
     2316        .content-area .has-featured-image .entry-header,
     2317        .content-area .format-standard .entry-header {
     2318                margin-top: -48px;
     2319        }
     2320        .content-area .format-standard.post-password-required .entry-header {
    23332321                margin-top: 0;
    23342322        }
    … …  
    23442332                margin-right: 33.33333333%;
    23452333        }
    2346         .content-area .entry-header {
     2334        .content-area .has-featured-image .entry-header,
     2335        .content-area .format-standard .entry-header {
    23472336                margin-top: 0;
    23482337        }
    … …  
    23862375                margin-right: 0;
    23872376        }
     2377        .full-width .content-area .has-featured-image .entry-header,
     2378        .full-width .content-area .format-standard .entry-header {
     2379                margin-top: -48px;
     2380        }
    23882381}
    23892382
    … …  
    24182411                max-width: 810px;
    24192412        }
    2420         .single-attachment .entry-content .attachment {
    2421                 text-align: center;
     2413        .single-attachment .entry-content .attachment img {
     2414                margin: 0 auto;
    24222415        }
    24232416        .full-width .entry-content blockquote.alignleft,
    … …  
    24352428
    24362429@media screen and (min-width: 870px) {
    2437         .content-area {
     2430        .content-area,
     2431        .content-sidebar,
     2432        .ephemera {
    24382433                padding-top: 72px;
    24392434        }
    2440         .home .content-area {
    2441                 padding-top: 36px;
    2442         }
    2443         .content-area .entry-header {
     2435        .content-area .has-featured-image .entry-header,
     2436        .content-area .format-standard .entry-header {
    24442437                margin-top: -48px;
    24452438        }
    2446         .content-area .format-aside .entry-header,
    2447         .content-area .format-quote .entry-header,
    2448         .content-area .format-link .entry-header,
    2449         .content-area .format-video .entry-header,
    2450         .content-area .format-image .entry-header {
    2451                 margin-top: 12px;
    2452         }
    2453         .single .content-area .format-aside .entry-header,
    2454         .single .content-area .format-quote .entry-header,
    2455         .single .content-area .format-link .entry-header,
    2456         .single .content-area .format-image .entry-header,
    2457         .single .content-area .format-video .entry-header {
     2439        .content-area .format-standard.post-password-required .entry-header {
    24582440                margin-top: 0;
    24592441        }
    … …  
    25122494        .content-area .entry-header {
    25132495                margin-top: 0;
    2514         }
    2515         .content-area .entry-header
    2516         .content-area .entry-content,
    2517         .content-area .entry-summary,
    2518         .content-area footer.entry-meta,
    2519         .archive-header,
    2520         .page-header,
    2521         .page-content,
    2522         .post-navigation,
    2523         .image-navigation,
    2524         .comments-area {
    2525                 padding-right: 0;
    2526                 padding-left: 0;
    25272496        }
    25282497        .site-footer {
    … …  
    26112580                padding-left: 182px;
    26122581        }
     2582        .content-area .has-featured-image .entry-header,
     2583        .content-area .format-standard .entry-header {
     2584                margin-top: 0;
     2585        }
    26132586}
    26142587
    26152588@media screen and (min-width: 1040px) {
    2616         .content-area .entry-header {
     2589        .content-area .has-featured-image .entry-header,
     2590        .content-area .format-standard .entry-header {
    26172591                margin-top: -48px;
     2592        }
     2593        .content-area .format-standard.post-password-required .entry-header {
     2594                margin-top: 0;
    26182595        }
    26192596        .content-area .entry-header,
    … …  
    26292606                padding-right: 15px;
    26302607                padding-left: 15px;
     2608        }
     2609        .full-width .content-area .entry-header,
     2610        .full-width .content-area .entry-content,
     2611        .full-width .content-area .entry-summary,
     2612        .full-width .content-area footer.entry-meta,
     2613        .full-width .archive-header,
     2614        .full-width .page-header,
     2615        .full-width .page-content,
     2616        .full-width .post-navigation,
     2617        .full-width .image-navigation,
     2618        .full-width .comments-area {
     2619                padding-right: 30px;
     2620                padding-left: 30px;
    26312621        }
    26322622}
Note: See TracChangeset for help on using the changeset viewer.