Ticket #38426: 38426.3.diff
File 38426.3.diff, 31.3 KB (added by , 8 years ago) |
---|
-
src/wp-content/themes/twentyseventeen/assets/js/customize-controls.js
1 /** 2 * Scripts within the customizer controls window. 3 * 4 * Contextually shows the color hue control and informs the preview 5 * when users open or close the front page sections section. 6 */ 7 8 ( function() { 9 wp.customize.bind( 'ready', function() { 10 11 // Only show the color hue control when there's a custom color scheme. 12 wp.customize( 'colorscheme', function( setting ) { 13 wp.customize.control( 'colorscheme_hue', function( control ) { 14 var visibility = function() { 15 if ( 'custom' === setting.get() ) { 16 control.container.slideDown( 180 ); 17 } else { 18 control.container.slideUp( 180 ); 19 } 20 }; 21 22 visibility(); 23 setting.bind( visibility ); 24 }); 25 }); 26 27 // Detect when the front page sections section is expanded (or closed) so we can adjust the preview accordingly 28 wp.customize.section( 'theme_options' ).expanded.bind( function( isExpanding ) { 29 30 // Value of isExpanding will = true if you're entering the section, false if you're leaving it 31 wp.customize.previewer.send( 'section-highlight', { expanded: isExpanding } ); 32 } ); 33 } ); 34 } )( jQuery ); -
src/wp-content/themes/twentyseventeen/assets/js/customize-preview.js
1 /** 2 * File customize-preview.js. 3 * 4 * Instantly live-update customizer settings in the preview for improved user experience. 5 */ 6 7 ( function( $ ) { 8 9 // Collect information from customize-controls.js about which panels are opening 10 wp.customize.bind( 'preview-ready', function() { 11 wp.customize.preview.bind( 'section-highlight', function( data ) { 12 13 // Only on the front page. 14 if ( ! $( 'body' ).hasClass( 'twentyseventeen-front-page' ) ) { 15 return; 16 } 17 18 // When the section is expanded, show and scroll to the content placeholders, exposing the edit links. 19 if ( true === data.expanded ) { 20 $( 'body' ).addClass( 'highlight-front-sections' ); 21 $( '.panel-placeholder' ).slideDown( 200, function() { 22 $.scrollTo( $( '#panel1' ), { 23 duration: 600, 24 offset: { 'top': -70 } // Account for sticky menu. 25 } ); 26 }); 27 28 // If we've left the panel, hide the placeholders and scroll back to the top 29 } else { 30 $( 'body' ).removeClass( 'highlight-front-sections' ); 31 $( '.panel-placeholder' ).slideUp( 200 ); // Don't change scroll when leaving - it's likely to have unintended consequences. 32 } 33 } ); 34 } ); 35 36 // Site title and description. 37 wp.customize( 'blogname', function( value ) { 38 value.bind( function( to ) { 39 $( '.site-title a' ).text( to ); 40 } ); 41 } ); 42 wp.customize( 'blogdescription', function( value ) { 43 value.bind( function( to ) { 44 $( '.site-description' ).text( to ); 45 } ); 46 } ); 47 48 // Header text color. 49 wp.customize( 'header_textcolor', function( value ) { 50 value.bind( function( to ) { 51 if ( 'blank' === to ) { 52 $( '.site-title, .site-description' ).css( { 53 'clip': 'rect(1px, 1px, 1px, 1px)', 54 'position': 'absolute' 55 } ); 56 $( 'body' ).addClass( 'title-tagline-hidden' ); 57 } else { 58 $( '.site-title, .site-description' ).css( { 59 'clip': 'auto', 60 'position': 'relative' 61 } ); 62 $( '.site-branding, .site-branding a, .site-description, .site-description a' ).css( { 63 'color': to 64 } ); 65 $( 'body' ).removeClass( 'title-tagline-hidden' ); 66 } 67 } ); 68 } ); 69 70 // Color scheme. 71 wp.customize( 'colorscheme', function( value ) { 72 value.bind( function( to ) { 73 74 // Update color body class. 75 $( 'body' ).removeClass( 'colors-light colors-dark colors-custom' ) 76 .addClass( 'colors-' + to ); 77 } ); 78 } ); 79 80 // Custom color hue. 81 wp.customize( 'colorscheme_hue', function( value ) { 82 value.bind( function( to ) { 83 84 // Update custom color CSS 85 var style = $( '#custom-theme-colors' ), 86 hue = style.data( 'hue' ), 87 css = style.html(); 88 89 css = css.split( hue + ',' ).join( to + ',' ); // Equivalent to css.replaceAll, with hue followed by comma to prevent values with units from being changed. 90 style.html( css ) 91 .data( 'hue', to ); 92 } ); 93 } ); 94 95 // Page layouts. 96 wp.customize( 'page_layout', function( value ) { 97 value.bind( function( to ) { 98 if ( 'one-column' === to ) { 99 $( 'body' ).addClass( 'page-one-column' ).removeClass( 'page-two-column' ); 100 } else { 101 $( 'body' ).removeClass( 'page-one-column' ).addClass( 'page-two-column' ); 102 } 103 } ); 104 } ); 105 } )( jQuery ); -
src/wp-content/themes/twentyseventeen/assets/js/customizer.js
1 /**2 * File customizer.js.3 *4 * Theme Customizer enhancements for a better user experience.5 *6 * Contains handlers to make Theme Customizer preview reload changes asynchronously.7 */8 9 ( function( $ ) {10 11 // Collect information from panel-customizer.js about which panels are opening12 wp.customize.bind( 'preview-ready', function() {13 wp.customize.preview.bind( 'section-highlight', function( data ) {14 15 // If there's an expanded panel section, scroll down to that panel & highlight in the preview16 if ( true === data.expanded ) {17 $.scrollTo( $( '.' + data.section ), {18 duration: 600,19 offset: { 'top': -40 }20 } );21 $( '.' + data.section ).addClass( 'twentyseventeen-highlight' );22 23 // If we've left the panel, remove the highlight and scroll back to the top24 } else {25 $.scrollTo( $( '#masthead' ), {26 duration: 300,27 offset: { 'top': 0 }28 } );29 $( '.' + data.section ).removeClass( 'twentyseventeen-highlight' );30 }31 } );32 } );33 34 // Site title and description.35 wp.customize( 'blogname', function( value ) {36 value.bind( function( to ) {37 $( '.site-title a' ).text( to );38 } );39 } );40 wp.customize( 'blogdescription', function( value ) {41 value.bind( function( to ) {42 $( '.site-description' ).text( to );43 } );44 } );45 46 // Header text color.47 wp.customize( 'header_textcolor', function( value ) {48 value.bind( function( to ) {49 if ( 'blank' === to ) {50 $( '.site-title, .site-description' ).css( {51 'clip': 'rect(1px, 1px, 1px, 1px)',52 'position': 'absolute'53 } );54 $( 'body' ).addClass( 'title-tagline-hidden' );55 } else {56 $( '.site-title, .site-description' ).css( {57 'clip': 'auto',58 'position': 'relative'59 } );60 $( '.site-branding, .site-branding a, .site-description, .site-description a' ).css( {61 'color': to62 } );63 $( 'body' ).removeClass( 'title-tagline-hidden' );64 }65 } );66 } );67 68 // Color scheme.69 wp.customize( 'colorscheme', function( value ) {70 value.bind( function( to ) {71 72 // Update color body class.73 $( 'body' ).removeClass( 'colors-light colors-dark colors-custom' )74 .addClass( 'colors-' + to );75 } );76 } );77 78 // Custom color hue.79 wp.customize( 'colorscheme_hue', function( value ) {80 value.bind( function( to ) {81 82 // Update custom color CSS83 var style = $( '#custom-theme-colors' ),84 hue = style.data( 'hue' ),85 css = style.html();86 87 css = css.split( hue + ',' ).join( to + ',' ); // Equivalent to css.replaceAll, with hue followed by comma to prevent values with units from being changed.88 style.html( css )89 .data( 'hue', to );90 } );91 } );92 93 // Page layouts.94 wp.customize( 'page_options', function( value ) {95 value.bind( function( to ) {96 if ( 'one-column' === to ) {97 $( 'body' ).addClass( 'page-one-column' ).removeClass( 'page-two-column' );98 } else {99 $( 'body' ).removeClass( 'page-one-column' ).addClass( 'page-two-column' );100 }101 } );102 } );103 } )( jQuery ); -
src/wp-content/themes/twentyseventeen/assets/js/panel-customizer.js
1 /**2 * Theme Customizer enhancements, specific to panels, for a better user experience.3 *4 * This allows us to detect when the user has opened specific sections within the Customizer,5 * and adjust our preview pane accordingly.6 */7 8 ( function() {9 10 wp.customize.bind( 'ready', function() {11 12 // Detect when the section for each panel is expanded (or closed) so we can adjust preview accordingly13 wp.customize.section( 'panel_1' ).expanded.bind( function( isExpanding ) {14 15 // Value of isExpanding will = true if you're entering the section, false if you're leaving it16 wp.customize.previewer.send( 'section-highlight', { section: 'twentyseventeen-panel1', expanded: isExpanding } );17 } );18 19 // Detect when the section for each panel is expanded (or closed) so we can adjust preview accordingly20 wp.customize.section( 'panel_2' ).expanded.bind( function( isExpanding ) {21 22 // Value of isExpanding = true if you're entering the section, false if you're leaving it23 wp.customize.previewer.send( 'section-highlight', { section: 'twentyseventeen-panel2', expanded: isExpanding } );24 } );25 26 // Detect when the section for each panel is expanded (or closed) so we can adjust preview accordingly27 wp.customize.section( 'panel_3' ).expanded.bind( function( isExpanding ) {28 29 // Value of isExpanding will = true if you're entering the section, false if you're leaving it30 wp.customize.previewer.send( 'section-highlight', { section: 'twentyseventeen-panel3', expanded: isExpanding } );31 } );32 33 // Detect when the section for each panel is expanded (or closed) so we can adjust preview accordingly34 wp.customize.section( 'panel_4' ).expanded.bind( function( isExpanding ) {35 36 // Value of isExpanding will = true if you're entering the section, false if you're leaving it37 wp.customize.previewer.send( 'section-highlight', { section: 'twentyseventeen-panel4', expanded: isExpanding } );38 } );39 40 } );41 } )( jQuery ); -
src/wp-content/themes/twentyseventeen/front-page.php
28 28 29 29 <?php 30 30 // Get each of our panels and show the post data. 31 $panels = array( '1', '2', '3', '4' );32 $titles = array();33 34 global $twentyseventeencounter; // Used in template-parts/page/content-front-page-panels.php file.35 36 31 if ( 0 !== twentyseventeen_panel_count() || is_customize_preview() ) : // If we have pages to show. 37 32 38 $twentyseventeencounter = 1; 33 /** 34 * Filter number of front page sections in Twenty Seventeen. 35 * 36 * @since Twenty Seventeen 1.0 37 * 38 * @param $num_sections integer 39 */ 40 $num_sections = apply_filters( 'twentyseventeen_front_page_sections', 4 ); 41 global $twentyseventeencounter; 39 42 40 foreach ( $panels as $panel ) :41 if ( get_theme_mod( 'panel_' . $panel ) ) :42 $post = get_post( get_theme_mod( 'panel_' . $panel ) );43 setup_postdata( $post);44 set_query_var( 'panel', $panel );43 // Create a setting and control for each of the sections available in the theme. 44 for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) { 45 $twentyseventeencounter = $i; 46 twentyseventeen_front_page_section( null, $i ); 47 } 45 48 46 $titles[] = get_the_title(); // Put page titles in an array for use in navigation. 47 get_template_part( 'template-parts/page/content', 'front-page-panels' ); 49 endif; // The if ( 0 !== twentyseventeen_panel_count() ) ends here. ?> 48 50 49 wp_reset_postdata();50 else :51 // The output placeholder anchor.52 echo '<article class="panel-placeholder panel twentyseventeen-panel twentyseventeen-panel' . esc_attr( $twentyseventeencounter ) . '" id="panel' . esc_attr( $twentyseventeencounter ) . '"><span class="twentyseventeen-panel-title">' . sprintf( __( 'Panel %1$s Placeholder', 'twentyseventeen' ), esc_attr( $twentyseventeencounter ) ) . '</span></article>';53 endif;54 55 $twentyseventeencounter++;56 endforeach;57 ?>58 59 <?php endif; // The if ( 0 !== twentyseventeen_panel_count() ) ends here.60 ?>61 62 51 </main><!-- #main --> 63 52 </div><!-- #primary --> 64 53 -
src/wp-content/themes/twentyseventeen/inc/color-patterns.php
312 312 .colors-custom .next.page-numbers:focus, 313 313 .colors-custom .next.page-numbers:hover, 314 314 .colors-custom .site-content .wp-playlist-light .wp-playlist-item:hover, 315 .colors-custom .site-content .wp-playlist-light .wp-playlist-item:focus { 315 .colors-custom .site-content .wp-playlist-light .wp-playlist-item:focus, 316 .colors-custom .customize-partial-edit-shortcut:before { 316 317 background: hsl( ' . esc_attr( $hue ) . ', ' . esc_attr( $saturation ) . ', 46% ); /* base: #767676; */ 317 318 } 318 319 -
src/wp-content/themes/twentyseventeen/inc/customizer.php
1 1 <?php 2 2 /** 3 * Twenty Seventeen: ThemeCustomizer3 * Twenty Seventeen: Customizer 4 4 * 5 5 * @package WordPress 6 6 * @subpackage Twenty_Seventeen … … 60 60 ) ) ); 61 61 62 62 /** 63 * Add the Theme Options section.63 * Theme options. 64 64 */ 65 $wp_customize->add_ panel( 'options_panel', array(66 'title' 67 ' description' => __( 'Configure your theme settings', 'twentyseventeen' ),65 $wp_customize->add_section( 'theme_options', array( 66 'title' => __( 'Theme Options', 'twentyseventeen' ), 67 'priority' => 130, // Before Additional CSS. 68 68 ) ); 69 69 70 // Page Options. 71 $wp_customize->add_section( 'page_options', array( 72 'title' => __( 'Single Page Layout', 'twentyseventeen' ), 73 'active_callback' => 'twentyseventeen_is_page', 74 'panel' => 'options_panel', 75 ) ); 76 77 $wp_customize->add_setting( 'page_options', array( 70 $wp_customize->add_setting( 'page_layout', array( 78 71 'default' => 'two-column', 79 'sanitize_callback' => 'twentyseventeen_sanitize_ layout',72 'sanitize_callback' => 'twentyseventeen_sanitize_page_layout', 80 73 'transport' => 'postMessage', 81 74 ) ); 82 75 83 $wp_customize->add_control( 'page_ options', array(76 $wp_customize->add_control( 'page_layout', array( 84 77 'label' => __( 'Page Layout', 'twentyseventeen' ), 85 'section' => ' page_options',78 'section' => 'theme_options', 86 79 'type' => 'radio', 87 80 'description' => __( 'When no sidebar widgets are assigned, you can opt to display all pages with a one column or two column layout. When the two column layout is assigned, the page title is in one column and content is in the other.', 'twentyseventeen' ), 88 81 'choices' => array( … … 89 82 'one-column' => __( 'One Column', 'twentyseventeen' ), 90 83 'two-column' => __( 'Two Column', 'twentyseventeen' ), 91 84 ), 85 'active_callback' => 'twentyseventeen_is_page_without_sidebar', 92 86 ) ); 93 87 94 // Panel 1. 95 $wp_customize->add_section( 'panel_1', array( 96 'title' => __( 'Panel 1', 'twentyseventeen' ), 97 'active_callback' => 'is_front_page', 98 'panel' => 'options_panel', 99 'description' => __( 'Add an image to your panel by setting a featured image in the page editor. If you don’t select a page, this panel will not be displayed.', 'twentyseventeen' ), 100 ) ); 88 /** 89 * Filter number of front page sections in Twenty Seventeen. 90 * 91 * @since Twenty Seventeen 1.0 92 * 93 * @param $num_sections integer 94 */ 95 $num_sections = apply_filters( 'twentyseventeen_front_page_sections', 4 ); 101 96 102 $wp_customize->add_setting( 'panel_1', array( 103 'default' => false, 104 'sanitize_callback' => 'absint', 105 ) ); 97 // Create a setting and control for each of the sections available in the theme. 98 for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) { 99 $wp_customize->add_setting( 'panel_' . $i, array( 100 'default' => false, 101 'sanitize_callback' => 'absint', 102 'transport' => 'postMessage', 103 ) ); 106 104 107 $wp_customize->add_control( 'panel_1', array( 108 'label' => __( 'Panel Content', 'twentyseventeen' ), 109 'section' => 'panel_1', 110 'type' => 'dropdown-pages', 111 ) ); 105 $wp_customize->add_control( 'panel_' . $i, array( 106 /* translators: %d is the front page section number */ 107 'label' => sprintf( __( 'Front Page Section %d Content', 'twentyseventeen' ), $i ), 108 'description' => ( 1 !== $i ? '' : __( 'Select pages to feature in each area from the dropdowns. Add an image to a section by setting a featured image in the page editor. Empty sections will not be displayed.', 'twentyseventeen' ) ), 109 'section' => 'theme_options', 110 'type' => 'dropdown-pages', 111 'allow_addition' => true, 112 'active_callback' => 'twentyseventeen_is_static_front_page', 113 ) ); 112 114 113 // Panel 2. 114 $wp_customize->add_section( 'panel_2', array( 115 'title' => __( 'Panel 2', 'twentyseventeen' ), 116 'active_callback' => 'is_front_page', 117 'panel' => 'options_panel', 118 'description' => __( 'Add an image to your panel by setting a featured image in the page editor. If you don’t select a page, this panel will not be displayed.', 'twentyseventeen' ), 119 ) ); 120 121 $wp_customize->add_setting( 'panel_2', array( 122 'default' => false, 123 'sanitize_callback' => 'absint', 124 ) ); 125 126 $wp_customize->add_control( 'panel_2', array( 127 'label' => __( 'Panel Content', 'twentyseventeen' ), 128 'section' => 'panel_2', 129 'type' => 'dropdown-pages', 130 ) ); 131 132 // Panel 3. 133 $wp_customize->add_section( 'panel_3', array( 134 'title' => __( 'Panel 3', 'twentyseventeen' ), 135 'active_callback' => 'is_front_page', 136 'panel' => 'options_panel', 137 'description' => __( 'Add an image to your panel by setting a featured image in the page editor. If you don’t select a page, this panel will not be displayed.', 'twentyseventeen' ), 138 ) ); 139 140 $wp_customize->add_setting( 'panel_3', array( 141 'default' => false, 142 'sanitize_callback' => 'absint', 143 ) ); 144 145 $wp_customize->add_control( 'panel_3', array( 146 'label' => __( 'Panel Content', 'twentyseventeen' ), 147 'section' => 'panel_3', 148 'type' => 'dropdown-pages', 149 ) ); 150 151 // Panel 4. 152 $wp_customize->add_section( 'panel_4', array( 153 'title' => __( 'Panel 4', 'twentyseventeen' ), 154 'active_callback' => 'is_front_page', 155 'panel' => 'options_panel', 156 'description' => __( 'Add an image to your panel by setting a featured image in the page editor. If you don’t select a page, this panel will not be displayed.', 'twentyseventeen' ), 157 ) ); 158 159 $wp_customize->add_setting( 'panel_4', array( 160 'default' => false, 161 'sanitize_callback' => 'absint', 162 ) ); 163 164 $wp_customize->add_control( 'panel_4', array( 165 'label' => __( 'Panel Content', 'twentyseventeen' ), 166 'section' => 'panel_4', 167 'type' => 'dropdown-pages', 168 ) ); 115 $wp_customize->selective_refresh->add_partial( 'panel_' . $i, array( 116 'selector' => '#panel' . $i, 117 'render_callback' => 'twentyseventeen_front_page_section', 118 'container_inclusive' => true, 119 ) ); 120 } 169 121 } 170 122 add_action( 'customize_register', 'twentyseventeen_customize_register' ); 171 123 172 124 /** 173 * Sanitize a radio button.125 * Sanitize the page layout options. 174 126 */ 175 function twentyseventeen_sanitize_ layout( $input ) {127 function twentyseventeen_sanitize_page_layout( $input ) { 176 128 $valid = array( 177 129 'one-column' => __( 'One Column', 'twentyseventeen' ), 178 130 'two-column' => __( 'Two Column', 'twentyseventeen' ), … … 223 175 } 224 176 225 177 /** 226 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.178 * Return whether we're previewing the front page and it's a static page. 227 179 */ 180 function twentyseventeen_is_static_front_page() { 181 return ( is_front_page() && ! is_home() ); 182 } 183 184 /** 185 * Return whether we're previewing a page and there are no widgets in the sidebar. 186 */ 187 function twentyseventeen_is_page_without_sidebar() { 188 return ( is_page() && ! is_active_sidebar( 'sidebar-1' ) ); 189 } 190 191 /** 192 * Bind JS handlers to instantly live-preview changes. 193 */ 228 194 function twentyseventeen_customize_preview_js() { 229 wp_enqueue_script( 'twentyseventeen-customize r', get_theme_file_uri( '/assets/js/customizer.js' ), array( 'customize-preview' ), '1.0', true );195 wp_enqueue_script( 'twentyseventeen-customize-preview', get_theme_file_uri( '/assets/js/customize-preview.js' ), array( 'customize-preview' ), '1.0', true ); 230 196 } 231 197 add_action( 'customize_preview_init', 'twentyseventeen_customize_preview_js' ); 232 198 233 199 /** 234 * Some extra JavaScript to improve the user experience in the Customizer for this theme.200 * Load dynamic logic for the customizer controls area. 235 201 */ 236 202 function twentyseventeen_panels_js() { 237 wp_enqueue_script( 'twentyseventeen- panel-customizer', get_theme_file_uri( '/assets/js/panel-customizer.js' ), array(), '1.0', true );203 wp_enqueue_script( 'twentyseventeen-customize-controls', get_theme_file_uri( '/assets/js/customize-controls.js' ), array(), '1.0', true ); 238 204 } 239 205 add_action( 'customize_controls_enqueue_scripts', 'twentyseventeen_panels_js' ); -
src/wp-content/themes/twentyseventeen/inc/template-functions.php
46 46 47 47 // Add class for one or two column page layouts. 48 48 if ( is_page() ) { 49 if ( 'one-column' === get_theme_mod( 'page_ options' ) ) {49 if ( 'one-column' === get_theme_mod( 'page_layout' ) ) { 50 50 $classes[] = 'page-one-column'; 51 51 } else { 52 52 $classes[] = 'page-two-column'; … … 72 72 * Primarily used to see if we have any panels active, duh. 73 73 */ 74 74 function twentyseventeen_panel_count() { 75 $panels = array( '1', '2', '3', '4' ); 75 76 76 $panel_count = 0; 77 77 78 foreach ( $panels as $panel ) { 79 if ( get_theme_mod( 'panel_' . $panel ) ) { 78 /** 79 * Filter number of front page sections in Twenty Seventeen. 80 * 81 * @since Twenty Seventeen 1.0 82 * 83 * @param $num_sections integer 84 */ 85 $num_sections = apply_filters( 'twentyseventeen_front_page_sections', 4 ); 86 87 // Create a setting and control for each of the sections available in the theme. 88 for ( $i = 1; $i < ( 1 + $num_sections ); $i++ ) { 89 if ( get_theme_mod( 'panel_' . $i ) ) { 80 90 $panel_count++; 81 91 } 82 92 } … … 90 100 function twentyseventeen_is_frontpage() { 91 101 return ( is_front_page() && ! is_home() ); 92 102 } 93 94 /**95 * Custom Active Callback to check for page.96 */97 function twentyseventeen_is_page() {98 return ( is_page() );99 } -
src/wp-content/themes/twentyseventeen/inc/template-tags.php
125 125 } 126 126 endif; 127 127 128 /** 129 * Display a front page section. 130 * 131 * @param $partial WP_Customize_Partial Partial associated with a selective refresh request. 132 * @param $id integer Front page section to display. 133 */ 134 function twentyseventeen_front_page_section( $partial = null, $id = 0 ) { 135 if ( is_a( $partial, 'WP_Customize_Partial' ) ) { 136 // Find out the id and set it up during a selective refresh. 137 global $twentyseventeencounter; 138 $id = str_replace( 'panel_', '', $partial->id ); 139 $twentyseventeencounter = $id; 140 } 128 141 142 global $post; // Modify the global post object before setting up post data. 143 if ( get_theme_mod( 'panel_' . $id ) ) { 144 global $post; 145 $post = get_post( get_theme_mod( 'panel_' . $id ) ); 146 setup_postdata( $post ); 147 set_query_var( 'panel', $id ); 148 149 get_template_part( 'template-parts/page/content', 'front-page-panels' ); 150 151 wp_reset_postdata(); 152 } else { 153 // The output placeholder anchor. 154 echo '<article class="panel-placeholder panel twentyseventeen-panel twentyseventeen-panel' . $id . '" id="panel' . $id . '"><span class="twentyseventeen-panel-title">' . sprintf( __( 'Panel %1$s Placeholder', 'twentyseventeen' ), $id ) . '</span></article>'; 155 } 156 } 157 129 158 /** 130 159 * Returns true if a blog has more than 1 category. 131 160 * -
src/wp-content/themes/twentyseventeen/style.css
2903 2903 # Customizer 2904 2904 --------------------------------------------------------------*/ 2905 2905 2906 /* Hide this until we're in the Customizer */ 2907 2908 .twentyseventeen-panel-title { 2906 /* Hide placeholders until we're in the front page sections section */ 2907 .panel-placeholder { 2909 2908 display: none; 2910 2909 } 2911 2910 2912 .twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel { 2913 /* Colour-code all panels (add 1 to account for #twentyseventeen-hero, so 2 is actually panel 1)*/ 2914 } 2915 2916 .twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel:after { 2911 .highlight-front-sections.twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel:after { 2917 2912 border: 2px dashed; 2918 2913 bottom: 1em; 2919 2914 content: ""; … … 2922 2917 position: absolute; 2923 2918 right: 1em; 2924 2919 top: 1em; 2920 z-index: -1; /* Prevent :after from preventing interactions within the section */ 2925 2921 } 2926 2922 2923 /* Used for placeholder text */ 2927 2924 .twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel .twentyseventeen-panel-title { 2928 color: #fff; 2929 display: inline-block; 2925 display: block; 2930 2926 font-size: 14px; 2931 2927 font-size: 0.875rem; 2932 2928 font-weight: 700; 2933 2929 letter-spacing: 1px; 2934 padding: 5px 10px; 2935 position: absolute; 2936 right: 3.2em; 2930 padding: 3em; 2937 2931 text-transform: uppercase; 2938 top: 3.2em; 2939 -webkit-transform: translate(3px, -3px); 2940 -ms-transform: translate(3px, -3px); 2941 transform: translate(3px, -3px); 2942 z-index: 3; 2932 text-align: center; 2943 2933 } 2944 2934 2945 .twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel:nth-of-type(1):after { 2935 /* Show borders on the custom page panels only when the front page sections are being edited */ 2936 .highlight-front-sections.twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel:nth-of-type(1):after { 2946 2937 border: none; 2947 2938 } 2948 2939 2949 .twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel:nth-of-type(2) .twentyseventeen-panel-title { 2950 background: #b569a2; 2951 } 2952 2953 .twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel:nth-of-type(2):after { 2940 .highlight-front-sections.twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel:nth-of-type(2):after { 2954 2941 border-color: #b569a2; 2955 2942 color: #b569a2; 2956 2943 } 2957 2944 2958 .twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel:nth-of-type(3) .twentyseventeen-panel-title { 2959 background: #8f68bd; 2960 } 2961 2962 .twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel:nth-of-type(3):after { 2945 .highlight-front-sections.twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel:nth-of-type(3):after { 2963 2946 border-color: #8f68bd; 2964 2947 color: #8f68bd; 2965 2948 } 2966 2949 2967 .twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel:nth-of-type(4) .twentyseventeen-panel-title { 2968 background: #575ebd; 2969 } 2970 2971 .twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel:nth-of-type(4):after { 2950 .highlight-front-sections.twentyseventeen-customizer.twentyseventeen-front-page .twentyseventeen-panel:nth-of-type(4):after { 2972 2951 border-color: #575ebd; 2973 2952 color: #575ebd; 2974 2953 } 2975 2954 2976 /* Add a highlight class to improve Customizer behaviour */ 2977 2978 @-webkit-keyframes flash { 2979 2980 0%, 2981 20%, 2982 40%, 2983 60%, 2984 80%, 2985 100% { 2986 opacity: 1; 2987 } 2988 2989 10%, 2990 30%, 2991 50%, 2992 70%, 2993 90% { 2994 opacity: 0; 2995 } 2955 .twentyseventeen-front-page.twentyseventeen-customizer #primary article.panel-placeholder { 2956 border: 0; 2996 2957 } 2997 2958 2998 @keyframes flash { 2999 3000 0%, 3001 20%, 3002 40%, 3003 60%, 3004 80%, 3005 100% { 3006 opacity: 1; 3007 } 3008 3009 10%, 3010 30%, 3011 50%, 3012 70%, 3013 90% { 3014 opacity: 0; 3015 } 2959 /* Add some space around the visual edit shortcut buttons. */ 2960 .twentyseventeen-panel .customize-partial-edit-shortcut:before { 2961 top: 30px; 2962 left: 30px; 3016 2963 } 3017 2964 3018 article.panel-placeholder { 3019 display: none; 2965 /* Prevent color schemes from showing 1px dots everywhere. */ 2966 .customize-partial-edit-shortcut { 2967 background: transparent !important; 3020 2968 } 3021 2969 3022 .twentyseventeen-front-page.twentyseventeen-customizer #primary article.panel-placeholder { 3023 border: 0; 2970 /* Ensure that placeholder icons are visible. */ 2971 .twentyseventeen-panel .customize-partial-edit-shortcut-hidden:before { 2972 visibility: visible; 3024 2973 } 3025 2974 3026 .twentyseventeen-customizer .panel-placeholder.twentyseventeen-highlight { 3027 display: block; 3028 height: 112px; 2975 /* Prevent icon colors from clashing with color schemes. */ 2976 .colors-custom .customize-partial-edit-shortcut:before { 2977 text-shadow: 0 -1px 1px rgba(0,0,0,.2), 2978 1px 0 1px rgba(0,0,0,.2), 2979 0 1px 1px rgba(0,0,0,.2), 2980 -1px 0 1px rgba(0,0,0,.2); 3029 2981 } 3030 2982 3031 .twentyseventeen-highlight:after {3032 -webkit-animation-duration: 2s;3033 animation-duration: 2s;3034 -webkit-animation-name: flash;3035 animation-name: flash;3036 -webkit-animation-timing-function: ease-in-out;3037 animation-timing-function: ease-in-out;3038 -webkit-animation-fill-mode: both;3039 animation-fill-mode: both;3040 }3041 2983 3042 2984 /*-------------------------------------------------------------- 3043 2985 ## SVGs Fallbacks -
src/wp-content/themes/twentyseventeen/template-parts/page/content-front-page-panels.php
12 12 13 13 ?> 14 14 15 <article id="p ost-<?php the_ID(); ?>" <?php post_class( 'twentyseventeen-panel ' ); ?> >15 <article id="panel<?php echo $twentyseventeencounter; ?>" <?php post_class( 'twentyseventeen-panel ' ); ?> > 16 16 17 <span class="panel twentyseventeen-panel<?php echo esc_attr( $twentyseventeencounter ); ?>" id="panel<?php echo esc_attr( $twentyseventeencounter ); ?>">18 <span class="twentyseventeen-panel-title"><?php printf( __( 'Panel %1$s', 'twentyseventeen' ), esc_attr( $twentyseventeencounter ) ); ?></span>19 </span>20 21 17 <?php if ( has_post_thumbnail() ) : 22 18 $thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'twentyseventeen-featured-image' ); 23 19 … … 77 73 endwhile; 78 74 wp_reset_postdata(); 79 75 ?> 80 </div><!-- . pique-recent-posts -->76 </div><!-- .recent-posts --> 81 77 <?php endif; ?> 82 78 <?php endif; ?> 83 79