Merge branch 'develop' into bump-deps

This commit is contained in:
IanDelMar 2022-09-23 21:15:29 +02:00 committed by GitHub
commit 175bae669c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 130 additions and 71 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -11351,11 +11351,6 @@ article img,
margin-left: 0;
}
@media (max-width: 991.98px) {
body.admin-bar .offcanvas-end {
margin-top: 46px;
}
}
.jumbotron {
margin-bottom: 0;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -11940,11 +11940,6 @@ article img,
margin-left: 0;
}
@media (max-width: 767.98px) {
body.admin-bar .offcanvas-end {
margin-top: 46px;
}
}
.has-blue-color,
.has-blue-color:visited {
color: #0d6efd;

2
css/theme.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -10,22 +10,48 @@ defined( 'ABSPATH' ) || exit;
if ( ! function_exists( 'understrap_customize_register' ) ) {
/**
* Register basic support (site title, description, header text color) for the Theme Customizer.
* Register basic support (site title, header text color) for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Customizer reference.
*/
function understrap_customize_register( $wp_customize ) {
$settings = array( 'blogname', 'blogdescription', 'header_textcolor' );
$settings = array( 'blogname', 'header_textcolor' );
foreach ( $settings as $setting ) {
$get_setting = $wp_customize->get_setting( $setting );
if ( $get_setting instanceof WP_Customize_Setting ) {
$get_setting->transport = 'postMessage';
}
}
// Override default partial for custom logo.
$wp_customize->selective_refresh->add_partial(
'custom_logo',
array(
'settings' => array( 'custom_logo' ),
'selector' => '.custom-logo-link',
'render_callback' => 'understrap_customize_partial_custom_logo',
'container_inclusive' => false,
)
);
}
}
add_action( 'customize_register', 'understrap_customize_register' );
if ( ! function_exists( 'understrap_customize_partial_custom_logo' ) ) {
/**
* Callback for rendering the custom logo, used in the custom_logo partial.
*
* @return string The custom logo markup or the site title.
*/
function understrap_customize_partial_custom_logo() {
if ( has_custom_logo() ) {
return get_custom_logo();
} else {
return get_bloginfo( 'name' );
}
}
}
if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
/**
* Register individual settings through customizer's API.
@ -191,6 +217,10 @@ if ( ! function_exists( 'understrap_theme_customize_register' ) ) {
)
);
$understrap_site_info = $wp_customize->get_setting( 'understrap_site_info_override' );
if ( $understrap_site_info instanceof WP_Customize_Setting ) {
$understrap_site_info->transport = 'postMessage';
}
}
} // End of if function_exists( 'understrap_theme_customize_register' ).
add_action( 'customize_register', 'understrap_theme_customize_register' );
@ -231,11 +261,17 @@ if ( ! function_exists( 'understrap_customize_preview_js' ) ) {
* Setup JS integration for live previewing.
*/
function understrap_customize_preview_js() {
$file = '/js/customizer.js';
$version = filemtime( get_template_directory() . $file );
if ( false === $version ) {
$version = time();
}
wp_enqueue_script(
'understrap_customizer',
get_template_directory_uri() . '/js/customizer.js',
get_template_directory_uri() . $file,
array( 'customize-preview' ),
'20130508',
(string) $version,
true
);
}
@ -250,11 +286,17 @@ if ( ! function_exists( 'understrap_customize_controls_js' ) ) {
* Setup JS integration for live previewing.
*/
function understrap_customize_controls_js() {
$file = '/js/customizer-controls.js';
$version = filemtime( get_template_directory() . $file );
if ( false === $version ) {
$version = time();
}
wp_enqueue_script(
'understrap_customizer',
get_template_directory_uri() . '/js/customizer-controls.js',
get_template_directory_uri() . $file,
array( 'customize-preview' ),
'20130508',
(string) $version,
true
);
}

View File

@ -30,6 +30,11 @@ if ( ! function_exists( 'understrap_scripts' ) ) {
$css_version = $theme_version . '.' . filemtime( get_template_directory() . $theme_styles );
wp_enqueue_style( 'understrap-styles', get_template_directory_uri() . $theme_styles, array(), $css_version );
// Fix that the offcanvas close icon is hidden behind the admin bar.
if ( 'bootstrap4' !== $bootstrap_version && is_admin_bar_showing() ) {
understrap_offcanvas_admin_bar_inline_styles();
}
wp_enqueue_script( 'jquery' );
$js_version = $theme_version . '.' . filemtime( get_template_directory() . $theme_scripts );
@ -41,3 +46,28 @@ if ( ! function_exists( 'understrap_scripts' ) ) {
} // End of if function_exists( 'understrap_scripts' ).
add_action( 'wp_enqueue_scripts', 'understrap_scripts' );
if ( ! function_exists( 'understrap_offcanvas_admin_bar_inline_styles' ) ) {
/**
* Add inline styles for the offcanvas component if the admin bar is visibile.
*
* Fixes that the offcanvas close icon is hidden behind the admin bar.
*/
function understrap_offcanvas_admin_bar_inline_styles() {
$navbar_type = get_theme_mod( 'understrap_navbar_type', 'collapse' );
if ( 'offcanvas' !== $navbar_type ) {
return;
}
$css = '
body.admin-bar .offcanvas.show {
margin-top: 32px;
}
@media screen and ( max-width: 782px ) {
body.admin-bar .offcanvas.show {
margin-top: 46px;
}
}';
wp_add_inline_style( 'understrap-styles', $css );
}
}

View File

@ -5,22 +5,25 @@
* when users open or close the front page sections section.
*/
(function() {
wp.customize.bind( 'ready', function() {
( function () {
wp.customize.bind( 'ready', function () {
// Only show the navbar type setting when running Bootstrap 5.
wp.customize( 'understrap_bootstrap_version', function( setting ) {
wp.customize.control( 'understrap_navbar_type', function( control ) {
var visibility = function() {
if ( 'bootstrap5' === setting.get() ) {
control.container.slideDown( 180 );
} else {
control.container.slideUp( 180 );
}
};
wp.customize( 'understrap_bootstrap_version', function ( setting ) {
wp.customize.control(
'understrap_navbar_type',
function ( control ) {
const visibility = function () {
if ( 'bootstrap5' === setting.get() ) {
control.container.slideDown( 180 );
} else {
control.container.slideUp( 180 );
}
};
visibility();
setting.bind( visibility );
});
});
});
})();
visibility();
setting.bind( visibility );
}
);
} );
} );
} )();

View File

@ -1,42 +1,42 @@
/**
* File customizcustomizer.js.
* File: customizer.js.
*
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/
( function( $ ) {
( function () {
let anchor = document.querySelector( '.navbar-brand' );
if ( 'H1' === anchor.tagName ) {
anchor = anchor.firstChild;
}
// Site title and description.
wp.customize( 'blogname', function( value ) {
value.bind( function( to ) {
$( '.site-title a' ).text( to );
} );
} );
wp.customize( 'blogdescription', function( value ) {
value.bind( function( to ) {
$( '.site-description' ).text( to );
// Site title.
wp.customize( 'blogname', function ( value ) {
value.bind( function ( to ) {
anchor.textContent = to;
} );
} );
// Header text color.
wp.customize( 'header_textcolor', function( value ) {
value.bind( function( to ) {
wp.customize( 'header_textcolor', function ( value ) {
value.bind( function ( to ) {
if ( 'blank' === to ) {
$( '.site-title a, .site-description' ).css( {
'clip': 'rect(1px, 1px, 1px, 1px)',
'position': 'absolute'
} );
anchor.style.clip = 'rect(1px, 1px, 1px, 1px)';
anchor.style.position = 'absolute';
} else {
$( '.site-title a, .site-description' ).css( {
'clip': 'auto',
'position': 'relative'
} );
$( '.site-title a, .site-description' ).css( {
'color': to
} );
anchor.style.clip = 'auto';
anchor.style.position = 'relative';
anchor.style.color = to;
}
} );
} );
} )( jQuery );
// Site info.
wp.customize( 'understrap_site_info_override', function ( value ) {
value.bind( function ( to ) {
document.querySelector( '.site-info' ).innerHTML = to;
} );
} );
} )();

View File

@ -54,3 +54,4 @@ parameters:
- '#Function understrap_categories_list\(\) has no return type specified.#'
- '#Function understrap_tags_list\(\) has no return type specified.#'
- '#Function understrap_comments_popup_link\(\) has no return type specified.#'
- '#Function understrap_offcanvas_admin_bar_inline_styles\(\) has no return type specified.#'

View File

@ -201,13 +201,6 @@ a.skip-link {
}
}
// Fixing Off-canvas close icon is hidden behind admin bar
@include media-breakpoint-down(md) {
body.admin-bar .offcanvas-end {
margin-top: 46px;
}
}
@if variable-exists('bootstrap4') {
// Reset Jumbotron default margin