Changeset 39241 for trunk/src/wp-includes/theme.php
- Timestamp:
- 11/15/2016 09:02:38 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/theme.php
r39240 r39241 1825 1825 } 1826 1826 1827 $core_content = array 1827 $core_content = array( 1828 1828 'widgets' => array( 1829 'text_business_info' => array ( 'text', array(1829 'text_business_info' => array( 'text', array( 1830 1830 'title' => _x( 'Find Us', 'Theme starter content' ), 1831 'text' => join( '', array 1831 'text' => join( '', array( 1832 1832 '<p><strong>' . _x( 'Address', 'Theme starter content' ) . '</strong><br />', 1833 1833 _x( '123 Main Street', 'Theme starter content' ) . '<br />' . _x( 'New York, NY 10001', 'Theme starter content' ) . '</p>', … … 1836 1836 ) ), 1837 1837 ) ), 1838 'search' => array ( 'search', array(1838 'search' => array( 'search', array( 1839 1839 'title' => _x( 'Site Search', 'Theme starter content' ), 1840 1840 ) ), 1841 'text_credits' => array ( 'text', array(1841 'text_credits' => array( 'text', array( 1842 1842 'title' => _x( 'Site Credits', 'Theme starter content' ), 1843 1843 'text' => sprintf( _x( 'This site was created on %s', 'Theme starter content' ), get_date_from_gmt( current_time( 'mysql', 1 ), 'c' ) ), 1844 1844 ) ), 1845 1845 ), 1846 'nav_menus' => array 1846 'nav_menus' => array( 1847 1847 'page_home' => array( 1848 1848 'type' => 'post_type', … … 1920 1920 foreach ( $config as $type => $args ) { 1921 1921 switch( $type ) { 1922 // Use options and theme_mods as-is 1922 // Use options and theme_mods as-is. 1923 1923 case 'options' : 1924 1924 case 'theme_mods' : … … 1926 1926 break; 1927 1927 1928 // Widgets are an extra level down due to groupings1928 // Widgets are grouped into sidebars. 1929 1929 case 'widgets' : 1930 foreach ( $config[ $type ] as $group => $items ) { 1931 foreach ( $items as $id ) { 1932 if ( ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $id ] ) ) { 1933 $content[ $type ][ $group ][ $id ] = $core_content[ $type ][ $id ]; 1930 foreach ( $config[ $type ] as $sidebar_id => $widgets ) { 1931 foreach ( $widgets as $widget ) { 1932 if ( is_array( $widget ) ) { 1933 $content[ $type ][ $sidebar_id ][] = $widget; 1934 } elseif ( is_string( $widget ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $widget ] ) ) { 1935 $content[ $type ][ $sidebar_id ][] = $core_content[ $type ][ $widget ]; 1934 1936 } 1935 1937 } … … 1937 1939 break; 1938 1940 1939 // And nav menu s are yet another level down1941 // And nav menu items are grouped into nav menus. 1940 1942 case 'nav_menus' : 1941 foreach ( $config[ $type ] as $group => $args2 ) { 1942 // Menu groups need a name 1943 if ( empty( $args['name'] ) ) { 1944 $args2['name'] = $group; 1943 foreach ( $config[ $type ] as $nav_menu_location => $nav_menu ) { 1944 1945 // Ensure nav menus get a name. 1946 if ( empty( $nav_menu['name'] ) ) { 1947 $nav_menu['name'] = $nav_menu_location; 1945 1948 } 1946 1949 1947 $content[ $type ][ $group ]['name'] = $args2['name']; 1948 1949 // Do we need to check if this is empty? 1950 foreach ( $args2['items'] as $id ) { 1951 if ( ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $id ] ) ) { 1952 $content[ $type ][ $group ]['items'][ $id ] = $core_content[ $type ][ $id ]; 1950 $content[ $type ][ $nav_menu_location ]['name'] = $nav_menu['name']; 1951 1952 foreach ( $nav_menu['items'] as $nav_menu_item ) { 1953 if ( is_array( $nav_menu_item ) ) { 1954 $content[ $type ][ $nav_menu_location ]['items'][] = $nav_menu_item; 1955 } elseif ( is_string( $nav_menu_item ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $nav_menu_item ] ) ) { 1956 $content[ $type ][ $nav_menu_location ]['items'][] = $core_content[ $type ][ $nav_menu_item ]; 1953 1957 } 1954 1958 } … … 1956 1960 break; 1957 1961 1958 1959 // Everything else should map at the next level 1962 // Everything else should map at the next level. 1960 1963 default : 1961 foreach( $config[ $type ] as $id ) { 1962 if ( ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $id ] ) ) { 1963 $content[ $type ][ $id ] = $core_content[ $type ][ $id ]; 1964 foreach( $config[ $type ] as $i => $item ) { 1965 if ( is_array( $item ) ) { 1966 $content[ $type ][ $i ] = $item; 1967 } elseif ( is_string( $item ) && ! empty( $core_content[ $type ] ) && ! empty( $core_content[ $type ][ $item ] ) ) { 1968 $content[ $type ][ $item ] = $core_content[ $type ][ $item ]; 1964 1969 } 1965 1970 }
Note: See TracChangeset
for help on using the changeset viewer.