Add option to display/hide the front page title

This commit is contained in:
te2dy 2021-09-16 22:53:27 +02:00
parent cd01830d75
commit 18a04d15c6
3 changed files with 31 additions and 0 deletions

View File

@ -10,6 +10,21 @@
// The speed of animations.
var speed = 200;
//
if ( $( "#_customize-input-show_on_front-radio-page:checked" ).val() ) {
$( "#customize-control-static_front_page_title" ).show();
} else {
$( "#customize-control-static_front_page_title" ).hide();
}
$( "#customize-control-show_on_front" ).change( function () {
if ( $( "#_customize-input-show_on_front-radio-page:checked" ).val() ) {
$( "#customize-control-static_front_page_title" ).show();
} else {
$( "#customize-control-static_front_page_title" ).hide();
}
} );
// Show sidebar parameters if a sidebar is set.
if ( $( "#_customize-input-marianne_global_layout-radio-two-column-left-sidebar:checked" ).val() ) {
$( "#customize-control-marianne_global_sidebar_width" ).show();

View File

@ -211,6 +211,15 @@ if ( ! function_exists( 'marianne_customize_register' ) ) {
'live' => true,
);
// Static Front Page.
$marianne_customizer_options[] = array(
'section' => 'static_front_page',
'id' => 'title',
'title' => __( 'Display the title of the front page.', 'marianne' ),
'description' => __( 'Default: unchecked.', 'marianne' ),
'type' => 'checkbox',
);
// Global.
$marianne_customizer_options[] = array(
'section' => 'marianne_global',
@ -1014,6 +1023,9 @@ if ( ! function_exists( 'marianne_options_default' ) ) {
'colors_scheme' => 'light',
'colors_link_hover' => 'blue',
// Static Front Page.
'static_front_page_title' => false,
// Global.
'marianne_global_layout' => 'one-column',
'marianne_global_sidebar_width' => 250,

View File

@ -15,6 +15,10 @@
<header class="entry-header">
<?php the_title( '<h1 class="entry-title page-title">', '</h1>' ); ?>
</header>
<?php elseif ( is_front_page() && true === marianne_get_theme_mod( 'static_front_page_title' ) ) : ?>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title page-title">', '</h1>' ); ?>
</header>
<?php endif; ?>
<?php