Make WordPress Core

Ticket #38615: 38615.diff

File 38615.diff, 2.4 KB (added by helen, 8 years ago)
  • src/wp-content/themes/twentyseventeen/functions.php

     
    123123
    124124                'posts' => array(
    125125                        'home',
    126                         'about',
     126                        'about' => array(
     127                                'thumbnail' => 94,
     128                        ),
    127129                        'contact',
    128130                        'blog',
    129131                        'homepage-section',
  • src/wp-includes/theme.php

     
    18241824                $config = array();
    18251825        }
    18261826
     1827        /**
     1828         * Filters the allowed extra post args for starter content.
     1829         *
     1830         * @since 4.7.0
     1831         *
     1832         * @param array $post_args Array of allowed post args.
     1833         * @param array $config    Array of theme-specific starter content configuration.
     1834         */
     1835        $post_args = apply_filters( 'starter_content_allowed_post_args', array( 'thumbnail', 'page_template' ), $config );
     1836
    18271837        $core_content = array(
    18281838                'widgets' => array(
    18291839                        'text_business_info' => array( 'text', array(
     
    20062016                                }
    20072017                                break;
    20082018
    2009                         // Everything else should map at the next level.
    2010                         default :
    2011                                 foreach( $config[ $type ] as $i => $item ) {
    2012                                         if ( is_array( $item ) ) {
    2013                                                 $content[ $type ][ $i ] = $item;
     2019                        // All that's left now are posts. Not a default case for the sake of clarity and future work.
     2020                        case 'posts' :
     2021                                foreach( $config[ $type ] as $id => $item ) {
     2022                                        // Posts and pages can be passed certain other args
     2023                                        if ( is_array( $item ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $id ] ) ) {
     2024                                                $content[ $type ][ $id ] = $core_content[ $type ][ $id ];
     2025
     2026                                                foreach( $item as $key => $value ) {
     2027                                                        if ( in_array( $key, $post_args ) ) {
     2028                                                                // Some special cases where fields are really in meta
     2029                                                                if ( 'thumbnail' === $key ) {
     2030                                                                        $content[ $type ][ $id ]['meta_input']['_thumbnail_id'] = $value;
     2031                                                                } elseif ( 'page_template' === $key ) {
     2032                                                                        $content[ $type ][ $id ]['meta_input']['_wp_page_template'] = $value;
     2033                                                                } else {
     2034                                                                        $content[ $type ][ $id ][ $key ] = $value;
     2035                                                                }
     2036                                                        }
     2037                                                }
    20142038                                        } elseif ( is_string( $item ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $item ] ) ) {
    20152039                                                $content[ $type ][ $item ] = $core_content[ $type ][ $item ];
    20162040                                        }