WordPress.org

Make WordPress Core


Ignore:
Timestamp:
11/01/2016 08:39:54 PM (5 years ago)
Author:
davidakennedy
Message:

Twenty Seventeen: Update page layout setting for all use cases

  • Makes sure the page layout setting also applies to pages, and is not completely hidden from them when a sidebar widget is present. Pages do not have a sidebar, so that was incorrect.
  • Updates description in Customizer for brevity and accuracy.
  • Applies setting to archive pages as well.
  • Updates CSS to reflect changes.

Props celloexpressions, laurelfulford.

Fixes #38538.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyseventeen/inc/customizer.php

    r38986 r39078  
    8080        'section'     => 'theme_options',
    8181        'type'        => 'radio',
    82         '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' ),
     82        'description' => __( 'When the two column layout is assigned, the page title is in one column and content is in the other.', 'twentyseventeen' ),
    8383        'choices'     => array(
    8484            'one-column' => __( 'One Column', 'twentyseventeen' ),
    8585            'two-column' => __( 'Two Column', 'twentyseventeen' ),
    8686        ),
    87         'active_callback' => 'twentyseventeen_is_page_without_sidebar',
     87        'active_callback' => 'twentyseventeen_is_view_with_layout_option',
    8888    ) );
    8989
     
    185185
    186186/**
    187  * Return whether we're previewing a page and there are no widgets in the sidebar.
    188  */
    189 function twentyseventeen_is_page_without_sidebar() {
    190     return ( is_page() && ! is_active_sidebar( 'sidebar-1' ) );
     187 * Return whether we're on a view that supports a one or two column layout.
     188 */
     189function twentyseventeen_is_view_with_layout_option() {
     190    // This option is available on all pages. It's also available on archives when there isn't a sidebar.
     191    return ( is_page() || ( is_archive() && ! is_active_sidebar( 'sidebar-1' ) ) );
    191192}
    192193
Note: See TracChangeset for help on using the changeset viewer.