Make WordPress Core

Changeset 39078


Ignore:
Timestamp:
11/01/2016 08:39:54 PM (8 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.

Location:
trunk/src/wp-content/themes/twentyseventeen
Files:
4 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
  • trunk/src/wp-content/themes/twentyseventeen/inc/template-functions.php

    r38986 r39078  
    4646
    4747    // Add class for one or two column page layouts.
    48     if ( is_page() ) {
     48    if ( is_page() || is_archive() ) {
    4949        if ( 'one-column' === get_theme_mod( 'page_layout' ) ) {
    5050            $classes[] = 'page-one-column';
  • trunk/src/wp-content/themes/twentyseventeen/rtl.css

    r39072 r39078  
    382382    }
    383383
    384     body:not(.has-sidebar) .page-header,
     384    body:not(.has-sidebar):not(.page-one-column) .page-header,
    385385    body.has-sidebar.error404 #primary .page-header,
    386     body.page-two-column #primary .entry-header {
     386    body.page-two-column:not(.archive) #primary .entry-header,
     387    body.page-two-column.archive:not(.has-sidebar) #primary .page-header {
    387388        float: right;
    388389    }
    389390
    390391    .blog:not(.has-sidebar) #primary article,
    391     .archive:not(.has-sidebar) #primary article,
     392    .archive:not(.has-sidebar):not(.page-one-column) #primary article,
    392393    .search:not(.has-sidebar) #primary article,
    393394    .has-sidebar.error404 #primary .page-content,
    394395    .error404.has-sidebar #primary .page-content,
    395     body.page-two-column #primary .entry-content,
     396    body.page-two-column:not(.archive) #primary .entry-content,
    396397    body.page-two-column #comments {
    397398        float: left;
     
    452453    }
    453454
    454     .has-sidebar .navigation.pagination {
     455    .has-sidebar .navigation.pagination,
     456    .archive.page-one-column:not(.has-sidebar) .navigation.pagination {
    455457        float: none;
    456458    }
  • trunk/src/wp-content/themes/twentyseventeen/style.css

    r39072 r39078  
    20242024
    20252025.single-post:not(.has-sidebar) #primary,
    2026 .page.page-one-column:not(.twentyseventeen-front-page) #primary {
     2026.page.page-one-column:not(.twentyseventeen-front-page) #primary,
     2027.archive.page-one-column:not(.has-sidebar) .page-header,
     2028.archive.page-one-column:not(.has-sidebar) #primary {
    20272029    margin-left: auto;
    20282030    margin-right: auto;
     
    36653667    }
    36663668
    3667     body:not(.has-sidebar) .page-header,
     3669    body:not(.has-sidebar):not(.page-one-column) .page-header,
    36683670    body.has-sidebar.error404 #primary .page-header,
    3669     body.page-two-column #primary .entry-header {
     3671    body.page-two-column:not(.archive) #primary .entry-header,
     3672    body.page-two-column.archive:not(.has-sidebar) #primary .page-header {
    36703673        float: left;
    36713674        width: 36%;
     
    36733676
    36743677    .blog:not(.has-sidebar) #primary article,
    3675     .archive:not(.has-sidebar) #primary article,
     3678    .archive:not(.page-one-column):not(.has-sidebar) #primary article,
    36763679    .search:not(.has-sidebar) #primary article,
    36773680    .error404:not(.has-sidebar) #primary .page-content,
    36783681    .error404.has-sidebar #primary .page-content,
    3679     body.page-two-column #primary .entry-content,
     3682    body.page-two-column:not(.archive) #primary .entry-content,
    36803683    body.page-two-column #comments {
    36813684        float: right;
     
    36953698    }
    36963699
    3697     .has-sidebar .navigation.pagination {
     3700    .has-sidebar .navigation.pagination,
     3701    .archive.page-one-column:not(.has-sidebar) .navigation.pagination {
    36983702        float: none;
    36993703        width: 100%;
     
    37793783    /* Pages */
    37803784
    3781     .page-one-column .entry-header {
     3785    .page.page-one-column .entry-header,
     3786    .twentyseventeen-front-page.page-one-column .entry-header,
     3787    .archive.page-one-column:not(.has-sidebar) .page-header {
    37823788        margin-bottom: 4em;
    37833789    }
Note: See TracChangeset for help on using the changeset viewer.