Ticket #38615: 38615.diff
File 38615.diff, 2.4 KB (added by , 8 years ago) |
---|
-
src/wp-content/themes/twentyseventeen/functions.php
123 123 124 124 'posts' => array( 125 125 'home', 126 'about', 126 'about' => array( 127 'thumbnail' => 94, 128 ), 127 129 'contact', 128 130 'blog', 129 131 'homepage-section', -
src/wp-includes/theme.php
1824 1824 $config = array(); 1825 1825 } 1826 1826 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 1827 1837 $core_content = array( 1828 1838 'widgets' => array( 1829 1839 'text_business_info' => array( 'text', array( … … 2006 2016 } 2007 2017 break; 2008 2018 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 } 2014 2038 } elseif ( is_string( $item ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $item ] ) ) { 2015 2039 $content[ $type ][ $item ] = $core_content[ $type ][ $item ]; 2016 2040 }