Make WordPress Core


Ignore:
Timestamp:
11/23/2016 09:52:27 AM (8 years ago)
Author:
helen
Message:

Theme starter content: Add support for featured images and page templates.

Featured image support means that attachments can now be imported. Media can be sideloaded from within theme or plugin directories. Like other posts, attachments are auto-drafts until customizer changes are published, and are not duplicated when they already exist in the customized state. Attachment IDs can be used for any number of purposes, much like post IDs. Twenty Seventeen now includes 3 images used as featured images to best showcase the multi-section homepage setup.

As featured image IDs are stored in post meta, it also made sense to add support for page templates. Twenty Seventeen does not include any such templates, but the functionality can be quite important for displaying themes to their best effect.

props westonruter, helen, flixos90.
fixes #38615.

File:
1 edited

Legend:

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

    r39317 r39346  
    124124        'posts' => array(
    125125            'home',
    126             'about',
    127             'contact',
    128             'blog',
    129             'homepage-section',
     126            'about' => array(
     127                'thumbnail' => '{{image-sandwich}}',
     128            ),
     129            'contact' => array(
     130                'thumbnail' => '{{image-espresso}}',
     131            ),
     132            'blog' => array(
     133                'thumbnail' => '{{image-coffee}}',
     134            ),
     135            'homepage-section' => array(
     136                'thumbnail' => '{{image-espresso}}',
     137            ),
     138        ),
     139
     140        'attachments' => array(
     141            'image-espresso' => array(
     142                'post_title' => _x( 'Espresso', 'Theme starter content' ),
     143                'file' => 'assets/images/espresso.jpg',
     144            ),
     145            'image-sandwich' => array(
     146                'post_title' => _x( 'Sandwich', 'Theme starter content' ),
     147                'file' => 'assets/images/sandwich.jpg',
     148            ),
     149            'image-coffee' => array(
     150                'post_title' => _x( 'Coffee', 'Theme starter content' ),
     151                'file' => 'assets/images/coffee.jpg',
     152            ),
    130153        ),
    131154
Note: See TracChangeset for help on using the changeset viewer.