Add the option to add a left sidebar (not styled yet)

This commit is contained in:
te2dy 2021-06-08 18:28:04 +02:00
parent f3713b0187
commit 8b3a2a027e
6 changed files with 40 additions and 9 deletions

View File

@ -135,7 +135,28 @@ if ( ! function_exists( 'marianne_custom_css' ) ) {
$css['body']['font-family'] = 'Menlo, Consolas, Monaco, "Liberation Mono", "Lucida Console", monospace';
}
$css['.site']['max-width'] = absint( $marianne_page_width ) . 'px';
$marianne_layout = marianne_get_theme_mod( 'marianne_global_layout' );
if ( 'one-column' === $marianne_layout ) {
$css['.site']['max-width'] = absint( $marianne_page_width ) . 'px';
} elseif ( 'two-column-left-sidebar' === $marianne_layout ) {
$css['.site']['display'] = 'grid';
$css['.site']['grid-template-areas'] = '"header content" "sidebar content" "sidebar footer"';
$css['.site']['max-width'] = absint( $marianne_page_width + 200 ) . 'px';
$css['.site-header']['grid-area'] = 'header';
$css['.site-header']['margin-right'] = '2em';
$css['.site-header']['padding-right'] = '2em';
$css['.site-content']['grid-area'] = 'content';
$css['.site-content']['width'] = absint( $marianne_page_width ) . 'px';
$css['.site-secondary']['grid-area'] = 'sidebar';
$css['.site-secondary']['margin-right'] = '2em';
$css['.site-secondary']['padding-right'] = '2em';
$css['.site-footer']['grid-area'] = 'footer';
$css['.site-footer']['width'] = absint( $marianne_page_width ) . 'px';
}
$css['.entry-thumbnail-wide .wp-post-image']['width'] = absint( $marianne_page_width ) . 'px';

View File

@ -212,6 +212,19 @@ if ( ! function_exists( 'marianne_customize_register' ) ) {
);
// Global.
$marianne_customizer_options[] = array(
'section' => 'marianne_global',
'id' => 'layout',
'title' => __( 'Layout', 'marianne' ),
'description' => __( 'You can choose to display your site in one or two columns, with a left sidebar. Default: one column.', 'marianne' ),
'type' => 'radio',
'value' => array(
'one-column' => __( 'One column', 'marianne' ),
'two-column-left-sidebar' => __( 'Two columns with a left sidebar', 'marianne' ),
),
'live' => false,
);
$marianne_customizer_options[] = array(
'section' => 'marianne_global',
'id' => 'page_width',
@ -922,6 +935,7 @@ if ( ! function_exists( 'marianne_options_default' ) ) {
'colors_link_hover' => 'blue',
// Global.
'marianne_global_layout' => 'one-column',
'marianne_global_page_width' => 480,
'marianne_global_images_expand' => false,
'marianne_global_font_family' => 'sans-serif',

View File

@ -37,9 +37,8 @@ get_header();
<?php get_template_part( 'loop' ); ?>
</main>
<?php get_sidebar(); ?>
</div>
<?php
get_sidebar();
get_footer();

View File

@ -27,9 +27,8 @@ get_header();
}
?>
</main>
<?php get_sidebar(); ?>
</div>
<?php
get_sidebar()
get_footer();

View File

@ -75,9 +75,8 @@ get_header();
</article>
<?php endif; ?>
</main>
<?php get_sidebar(); ?>
</div>
<?php
get_sidebar()
get_footer();

View File

@ -27,9 +27,8 @@ get_header();
}
?>
</main>
<?php get_sidebar(); ?>
</div>
<?php
get_sidebar()
get_footer();