WordPress.org

Make WordPress Core

Changeset 39720


Ignore:
Timestamp:
01/05/2017 07:28:27 PM (17 months ago)
Author:
ocean90
Message:

Twenty Seventeen: Introduce a theme-specific filter twentyseventeen_starter_content for customizing the starter content array.

Add some documentation to the default starter content.

Props sanket.parmar, celloexpressions.
Fixes #39109.

File:
1 edited

Legend:

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

    r39635 r39720  
    107107    add_editor_style( array( 'assets/css/editor-style.css', twentyseventeen_fonts_url() ) );
    108108
    109     add_theme_support( 'starter-content', array(
     109    // Define and register starter content to showcase the theme on new sites.
     110    $starter_content = array(
    110111        'widgets' => array(
     112            // Place three core-defined widgets in the sidebar area.
    111113            'sidebar-1' => array(
    112114                'text_business_info',
     
    115117            ),
    116118
     119            // Add the core-defined business info widget to the footer 1 area.
    117120            'sidebar-2' => array(
    118121                'text_business_info',
    119122            ),
    120123
     124            // Put two core-defined widgets in the footer 2 area.
    121125            'sidebar-3' => array(
    122126                'text_about',
     
    125129        ),
    126130
     131        // Specify the core-defined pages to create and add custom thumbnails to some of them.
    127132        'posts' => array(
    128133            'home',
     
    141146        ),
    142147
     148        // Create the custom image attachments used as post thumbnails for pages.
    143149        'attachments' => array(
    144150            'image-espresso' => array(
    145151                'post_title' => _x( 'Espresso', 'Theme starter content', 'twentyseventeen' ),
    146                 'file' => 'assets/images/espresso.jpg',
     152                'file' => 'assets/images/espresso.jpg', // URL relative to the template directory.
    147153            ),
    148154            'image-sandwich' => array(
     
    156162        ),
    157163
     164        // Default to a static front page and assign the front and posts pages.
    158165        'options' => array(
    159166            'show_on_front' => 'page',
     
    162169        ),
    163170
     171        // Set the front page section theme mods to the IDs of the core-registered pages.
    164172        'theme_mods' => array(
    165173            'panel_1' => '{{homepage-section}}',
     
    169177        ),
    170178
     179        // Set up nav menus for each of the two areas registered in the theme.
    171180        'nav_menus' => array(
     181            // Assign a menu to the "top" location.
    172182            'top' => array(
    173183                'name' => __( 'Top Menu', 'twentyseventeen' ),
    174184                'items' => array(
    175                     'link_home',
     185                    'link_home', // Note that the core "home" page is actually a link in case a static front page is not used.
    176186                    'page_about',
    177187                    'page_blog',
     
    179189                ),
    180190            ),
     191
     192            // Assign a menu to the "social" location.
    181193            'social' => array(
    182194                'name' => __( 'Social Links Menu', 'twentyseventeen' ),
     
    190202            ),
    191203        ),
    192     ) );
     204    );
     205
     206    /**
     207     * Filters Twenty Seventeen array of starter content.
     208     *
     209     * @since Twenty Seventeen 1.1
     210     *
     211     * @param array $starter_content Array of starter content.
     212     */
     213    $starter_content = apply_filters( 'twentyseventeen_starter_content', $starter_content );
     214
     215    add_theme_support( 'starter-content', $starter_content );
    193216}
    194217add_action( 'after_setup_theme', 'twentyseventeen_setup' );
Note: See TracChangeset for help on using the changeset viewer.