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.

Built from https://develop.svn.wordpress.org/trunk@39078


git-svn-id: http://core.svn.wordpress.org/trunk@39020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
David A. Kennedy 2016-11-01 20:40:31 +00:00
parent feb8ccf3d6
commit 9510f68efa
5 changed files with 28 additions and 19 deletions

View File

@ -79,12 +79,12 @@ function twentyseventeen_customize_register( $wp_customize ) {
'label' => __( 'Page Layout', 'twentyseventeen' ),
'section' => 'theme_options',
'type' => 'radio',
'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' ),
'description' => __( 'When the two column layout is assigned, the page title is in one column and content is in the other.', 'twentyseventeen' ),
'choices' => array(
'one-column' => __( 'One Column', 'twentyseventeen' ),
'two-column' => __( 'Two Column', 'twentyseventeen' ),
),
'active_callback' => 'twentyseventeen_is_page_without_sidebar',
'active_callback' => 'twentyseventeen_is_view_with_layout_option',
) );
/**
@ -184,10 +184,11 @@ function twentyseventeen_is_static_front_page() {
}
/**
* Return whether we're previewing a page and there are no widgets in the sidebar.
* Return whether we're on a view that supports a one or two column layout.
*/
function twentyseventeen_is_page_without_sidebar() {
return ( is_page() && ! is_active_sidebar( 'sidebar-1' ) );
function twentyseventeen_is_view_with_layout_option() {
// This option is available on all pages. It's also available on archives when there isn't a sidebar.
return ( is_page() || ( is_archive() && ! is_active_sidebar( 'sidebar-1' ) ) );
}
/**

View File

@ -45,7 +45,7 @@ function twentyseventeen_body_classes( $classes ) {
}
// Add class for one or two column page layouts.
if ( is_page() ) {
if ( is_page() || is_archive() ) {
if ( 'one-column' === get_theme_mod( 'page_layout' ) ) {
$classes[] = 'page-one-column';
} else {

View File

@ -381,18 +381,19 @@ input[type="checkbox"] {
right: -2.5em;
}
body:not(.has-sidebar) .page-header,
body:not(.has-sidebar):not(.page-one-column) .page-header,
body.has-sidebar.error404 #primary .page-header,
body.page-two-column #primary .entry-header {
body.page-two-column:not(.archive) #primary .entry-header,
body.page-two-column.archive:not(.has-sidebar) #primary .page-header {
float: right;
}
.blog:not(.has-sidebar) #primary article,
.archive:not(.has-sidebar) #primary article,
.archive:not(.has-sidebar):not(.page-one-column) #primary article,
.search:not(.has-sidebar) #primary article,
.has-sidebar.error404 #primary .page-content,
.error404.has-sidebar #primary .page-content,
body.page-two-column #primary .entry-content,
body.page-two-column:not(.archive) #primary .entry-content,
body.page-two-column #comments {
float: left;
}
@ -451,7 +452,8 @@ input[type="checkbox"] {
float: left;
}
.has-sidebar .navigation.pagination {
.has-sidebar .navigation.pagination,
.archive.page-one-column:not(.has-sidebar) .navigation.pagination {
float: none;
}

View File

@ -2023,7 +2023,9 @@ body:not(.twentyseventeen-front-page) .entry-header {
/* Single Post */
.single-post:not(.has-sidebar) #primary,
.page.page-one-column:not(.twentyseventeen-front-page) #primary {
.page.page-one-column:not(.twentyseventeen-front-page) #primary,
.archive.page-one-column:not(.has-sidebar) .page-header,
.archive.page-one-column:not(.has-sidebar) #primary {
margin-left: auto;
margin-right: auto;
max-width: 740px;
@ -3664,19 +3666,20 @@ object {
width: 32px;
}
body:not(.has-sidebar) .page-header,
body:not(.has-sidebar):not(.page-one-column) .page-header,
body.has-sidebar.error404 #primary .page-header,
body.page-two-column #primary .entry-header {
body.page-two-column:not(.archive) #primary .entry-header,
body.page-two-column.archive:not(.has-sidebar) #primary .page-header {
float: left;
width: 36%;
}
.blog:not(.has-sidebar) #primary article,
.archive:not(.has-sidebar) #primary article,
.archive:not(.page-one-column):not(.has-sidebar) #primary article,
.search:not(.has-sidebar) #primary article,
.error404:not(.has-sidebar) #primary .page-content,
.error404.has-sidebar #primary .page-content,
body.page-two-column #primary .entry-content,
body.page-two-column:not(.archive) #primary .entry-content,
body.page-two-column #comments {
float: right;
width: 58%;
@ -3694,7 +3697,8 @@ object {
width: 58%;
}
.has-sidebar .navigation.pagination {
.has-sidebar .navigation.pagination,
.archive.page-one-column:not(.has-sidebar) .navigation.pagination {
float: none;
width: 100%;
}
@ -3778,7 +3782,9 @@ object {
/* Pages */
.page-one-column .entry-header {
.page.page-one-column .entry-header,
.twentyseventeen-front-page.page-one-column .entry-header,
.archive.page-one-column:not(.has-sidebar) .page-header {
margin-bottom: 4em;
}

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-beta1-39077';
$wp_version = '4.7-beta1-39078';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.