Make WordPress Core

Ticket #39109: 39109.1.diff

File 39109.1.diff, 3.2 KB (added by celloexpressions, 10 years ago)

Add inline documentation for new filter and breaking down the starter content array.

  • src/wp-content/themes/twentyseventeen/functions.php

     
    103103         */
    104104        add_editor_style( array( 'assets/css/editor-style.css', twentyseventeen_fonts_url() ) );
    105105
    106         add_theme_support( 'starter-content', array(
     106        /*
     107         * Define and register starter content to showcase the theme on new sites.
     108         */
     109        $starter_content = array(
    107110                'widgets' => array(
    108                         'sidebar-1' => array(
     111                        'sidebar-1' => array( // Place three core-defined widgets in the sidebar area.
    109112                                'text_business_info',
    110113                                'search',
    111114                                'text_about',
    112115                        ),
    113116
    114                         'sidebar-2' => array(
     117                        'sidebar-2' => array( // Add the core-defined business info widget to the footer 1 area.
    115118                                'text_business_info',
    116119                        ),
    117120
    118                         'sidebar-3' => array(
     121                        'sidebar-3' => array( // Put two core-defined widgets in the footer 2 area.
    119122                                'text_about',
    120123                                'search',
    121124                        ),
    122125                ),
    123126
     127                // Specify the core-defined pages to create and add custom thumbnails to some of them.
    124128                'posts' => array(
    125129                        'home',
    126130                        'about' => array(
    … …  
    137141                        ),
    138142                ),
    139143
     144                // Create the custom image attachments used as post thumbnails for pages.
    140145                'attachments' => array(
    141146                        'image-espresso' => array(
    142147                                'post_title' => _x( 'Espresso', 'Theme starter content', 'twentyseventeen' ),
    143                                 'file' => 'assets/images/espresso.jpg',
     148                                'file' => 'assets/images/espresso.jpg', // URL relative to the template directory.
    144149                        ),
    145150                        'image-sandwich' => array(
    146151                                'post_title' => _x( 'Sandwich', 'Theme starter content', 'twentyseventeen' ),
    … …  
    152157                        ),
    153158                ),
    154159
     160                // Default to a static front page and assign the front and posts pages.
    155161                'options' => array(
    156162                        'show_on_front' => 'page',
    157163                        'page_on_front' => '{{home}}',
    … …  
    158164                        'page_for_posts' => '{{blog}}',
    159165                ),
    160166
     167                // Set the front page section theme mods to the IDs of the core-registered pages.
    161168                'theme_mods' => array(
    162169                        'panel_1' => '{{homepage-section}}',
    163170                        'panel_2' => '{{about}}',
    … …  
    165172                        'panel_4' => '{{contact}}',
    166173                ),
    167174
     175                // Set up nav menus for each of the two areas registered in the theme.
    168176                'nav_menus' => array(
    169                         'top' => array(
     177                        'top' => array( // Assign this menu to the "top" location.
    170178                                'name' => __( 'Top Menu', 'twentyseventeen' ),
    171179                                'items' => array(
    172                                         'link_home',
     180                                        'link_home', // Note that the core "home" page is actually a link in case a static front page is not used.
    173181                                        'page_about',
    174182                                        'page_blog',
    175183                                        'page_contact',
    176184                                ),
    177185                        ),
    178                         'social' => array(
     186                        'social' => array( // Assign this menu to the "social" location.
    179187                                'name' => __( 'Social Links Menu', 'twentyseventeen' ),
    180188                                'items' => array(
    181189                                        'link_yelp',
    … …  
    186194                                ),
    187195                        ),
    188196                ),
    189         ) );
     197        );
     198
     199        /**
     200         * Filter Twenty Seventeen starter content array.
     201         *
     202         * @since Twenty Seventeen 1.0
     203         *
     204         * @param $starter_content array
     205         */
     206        add_theme_support( 'starter-content', apply_filters( 'twentyseventeen_starter_content', $starter_content ) );
    190207}
    191208add_action( 'after_setup_theme', 'twentyseventeen_setup' );
    192209