Skip to content

Commit

Permalink
Merge branch 'develop' into last-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
IanDelMar committed Oct 13, 2022
2 parents 0b1b249 + c9a7dc7 commit 21892f9
Show file tree
Hide file tree
Showing 57 changed files with 2,086 additions and 3,167 deletions.
8 changes: 4 additions & 4 deletions .github/README.md
Expand Up @@ -4,7 +4,7 @@
[![Wordpress Theme Version](https://img.shields.io/wordpress/theme/v/understrap.svg)](https://wordpress.org/themes/understrap)
[![Wordpress Theme Active Installs](https://img.shields.io/wordpress/theme/installs/understrap.svg)](https://wordpress.org/themes/understrap/)
[![Github Last Commit](https://img.shields.io/github/last-commit/understrap/understrap/develop)](https://github.com/understrap/understrap/commits/develop)
[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)

#### See: [Official Demo](https://understrap.com) | Read: [Official Docs Page](https://docs.understrap.com/)

Expand Down Expand Up @@ -50,11 +50,11 @@ See [changelog](CHANGELOG.md)
## License

Copyright 2022 [Howard Development & Consulting, LLC](https://howarddc.com).
Understrap is distributed under the terms of the GNU GPL version 2
Understrap is distributed under the terms of the GNU GPL version 3

http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
https://www.gnu.org/licenses/gpl-3.0.en.html

## Credits
- Font Awesome: https://fontawesome.com/v4.7/license/ (Font: SIL OFL 1.1, (S)CSS: MIT)
- Bootstrap: http://getbootstrap.com | https://github.com/twbs/bootstrap/blob/master/LICENSE (MIT)
- Bootstrap: https://getbootstrap.com | https://github.com/twbs/bootstrap/blob/main/LICENSE (MIT)
- WP Bootstrap Navwalker by Edward McIntyre & William Patton: https://github.com/wp-bootstrap/wp-bootstrap-navwalker (GNU GPLv3)
4 changes: 4 additions & 0 deletions css/theme-bootstrap4.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/theme-bootstrap4.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/theme-bootstrap4.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/theme-bootstrap4.min.css.map

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions css/theme.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion css/theme.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/theme.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion css/theme.min.css.map

Large diffs are not rendered by default.

21 changes: 0 additions & 21 deletions inc/deprecated.php
Expand Up @@ -83,24 +83,3 @@ function understrap_slbd_count_widgets( $sidebar_id ) {
endif;
}
}

/**
* This function has never existed in any of the templates. It serves to extract
* strings for translations which have been removed or changed and may still be
* be present in child themes. The corresponding translations are not maintained.
*/
function deprecated_translations() {
array(
esc_html__( 'It looks like nothing was found at this location. Maybe try one of the links below or a search?', 'understrap' ),
esc_html__( 'Previous', 'understrap' ),
esc_html__( 'Next', 'understrap' ),
esc_html__( 'About:', 'understrap' ),
esc_html__( 'Profile', 'understrap' ),
esc_html__( 'Posts by', 'understrap' ),
esc_html__( 'Permanent Link:', 'understrap' ),
esc_html__( 'in', 'understrap' ),
esc_html__( 'Edit', 'understrap' ),
esc_html__( '1 Comment', 'understrap' ),
esc_html__( '% Comments', 'understrap' ),
);
}
2 changes: 1 addition & 1 deletion inc/hooks.php
Expand Up @@ -41,7 +41,7 @@ function understrap_add_site_info() {
),
sprintf(
/* translators: Theme version */
esc_html__( 'Version: %1$s', 'understrap' ),
esc_html__( 'Version: %s', 'understrap' ),
$the_theme->get( 'Version' ) // @phpstan-ignore-line -- theme exists
)
);
Expand Down
4 changes: 2 additions & 2 deletions inc/pagination.php
Expand Up @@ -50,8 +50,8 @@ function understrap_pagination( $args = array(), $class = 'pagination' ) {
array(
'mid_size' => 2,
'prev_next' => true,
'prev_text' => __( '«', 'understrap' ),
'next_text' => __( '»', 'understrap' ),
'prev_text' => _x( '«', 'previous set of posts', 'understrap' ),
'next_text' => _x( '»', 'next set of posts', 'understrap' ),
'current' => max( 1, get_query_var( 'paged' ) ),
'screen_reader_text' => __( 'Posts navigation', 'understrap' ),
)
Expand Down
2 changes: 1 addition & 1 deletion inc/template-tags.php
Expand Up @@ -230,7 +230,7 @@ function understrap_comment_navigation( $nav_id ) {
?>
<nav class="comment-navigation" id="<?php echo esc_attr( $nav_id ); ?>">

<h1 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'understrap' ); ?></h1>
<h1 class="screen-reader-text"><?php esc_html_e( 'Comments navigation', 'understrap' ); ?></h1>

<?php if ( get_previous_comments_link() ) { ?>
<div class="nav-previous">
Expand Down
2 changes: 1 addition & 1 deletion inc/widgets.php
Expand Up @@ -119,7 +119,7 @@ function understrap_add_block_widget_search_classes( $block_content, $block ) {
add_filter( 'render_block_core/search', 'understrap_add_block_widget_search_classes', 10, 2 );

/**
* Add active class of first item of carousel hero widget area.
* Add active class to first item of carousel hero widget area.
*
* @param array $params {
* Parameters passed to a widget’s display callback.
Expand Down
170 changes: 125 additions & 45 deletions inc/woocommerce.php
Expand Up @@ -23,6 +23,7 @@ function understrap_woocommerce_support() {

// Add Bootstrap classes to form fields.
add_filter( 'woocommerce_form_field_args', 'understrap_wc_form_field_args', 10, 3 );
add_filter( 'woocommerce_form_field_radio', 'understrap_wc_form_field_radio', 10, 4 );
add_filter( 'woocommerce_quantity_input_classes', 'understrap_quantity_input_classes' );
add_filter( 'woocommerce_loop_add_to_cart_args', 'understrap_loop_add_to_cart_args' );

Expand Down Expand Up @@ -75,79 +76,158 @@ function understrap_woocommerce_wrapper_end() {

if ( ! function_exists( 'understrap_wc_form_field_args' ) ) {
/**
* Filter hook function monkey patching form classes
* Author: Adriano Monecchi http://stackoverflow.com/a/36724593/307826
* Modifies the form field's arguments by input type. The arguments are used
* in `woocommerce_form_field()` to build the form fields.
*
* @see https://woocommerce.github.io/code-reference/namespaces/default.html#function_woocommerce_form_field
*
* @param array<string,mixed> $args Form field arguments.
* @param string $key Value of the fields name attribute.
* @param string|null $value Value of <select> option.
*
* @return array<string,mixed> Form field arguments.
*/
function understrap_wc_form_field_args( $args, $key, $value = null ) {
function understrap_wc_form_field_args( $args, $key, $value ) {
$bootstrap4 = 'bootstrap4' === get_theme_mod( 'understrap_bootstrap_version', 'bootstrap4' );

// Add margin to each form field's html element wrapper (<p></p>).
if ( $bootstrap4 ) {
$args['class'][] = 'form-group';
}
$args['class'][] = 'mb-3';

// Start field type switch case.
switch ( $args['type'] ) {
// Targets all select input type elements, except the country and state select input types.
case 'select':
case 'country':
/*
* Add a class to the field's html element wrapper - woocommerce
* input types (fields) are often wrapped within a <p></p> tag.
* WooCommerce will populate a <select> element of type 'country'
* with the country names. $args defined for this specific input
* type targets only the country <select> element.
*/
$args['class'][] = 'form-group mb-3';
// Add a class to the form input itself.
$args['input_class'][] = 'form-control';
// Add custom data attributes to the form input itself.
$args['custom_attributes'] = array(
'data-plugin' => 'select2',
'data-allow-clear' => 'true',
'aria-hidden' => 'true',
);
break;

/*
* By default WooCommerce will populate a select with the country names - $args
* defined for this specific input type targets only the country select element.
*/
case 'country':
$args['class'][] = 'form-group mb-3 single-country';
$args['class'][] = 'single-country';
break;

/*
* By default WooCommerce will populate a select with state names - $args defined
* for this specific input type targets only the country select element.
*/
case 'state':
$args['class'][] = 'form-group mb-3';
$args['custom_attributes'] = array(
'data-plugin' => 'select2',
'data-allow-clear' => 'true',
'aria-hidden' => 'true',
);
break;
case 'textarea':
$args['input_class'][] = 'form-control';
/*
* WooCommerce will populate a <select> element of type 'state'
* with the state names. $args defined for this specific input
* type targets only the state <select> element.
*/

// Add custom data attributes to the form input itself.
$args['custom_attributes']['data-plugin'] = 'select2';
$args['custom_attributes']['data-allow-clear'] = 'true';
$args['custom_attributes']['aria-hidden'] = 'true';
break;
case 'checkbox':
$args['class'][] = 'form-group mb-3';
/*
* WooCommerce checkbox markup differs from Bootstrap checkbox
* markup. We apply Bootstrap classes such that the WooCommerce
* checkbox look matches the Bootstrap checkbox look.
*/

// Get Bootstrap version specific CSS class base.
$base = $bootstrap4 ? 'custom-control' : 'form-check';

if ( isset( $args['label'] ) ) {
// Wrap the label in <span> tag.
$args['label'] = isset( $args['label'] ) ? '<span class="custom-control-label">' . $args['label'] . '<span>' : '';
// Add a class to the form input's <label> tag.
$args['label_class'][] = 'custom-control custom-checkbox';
$args['input_class'][] = 'custom-control-input';
$args['label'] = "<span class=\"{$base}-label\">{$args['label']}</span>";
}

// Add a class to the form input's <label> tag.
$args['label_class'][] = $base;
if ( $bootstrap4 ) {
$args['label_class'][] = 'custom-checkbox';
}

// Add a class to the form input itself.
$args['input_class'][] = $base . '-input';
break;
case 'select':
/*
* Targets all <select> elements, except the <select> elements
* of type country or of type state.
*/

// Add a class to the form input itself.
$args['input_class'][] = $bootstrap4 ? 'form-control' : 'form-select';

// Add custom data attributes to the form input itself.
$args['custom_attributes']['data-plugin'] = 'select2';
$args['custom_attributes']['data-allow-clear'] = 'true';
break;
case 'radio':
$args['label_class'][] = 'custom-control custom-radio';
$args['input_class'][] = 'custom-control-input';
// Get Bootstrap version specific CSS class base.
$base = $bootstrap4 ? 'custom-control' : 'form-check';

$args['label_class'][] = $base . '-label';
$args['input_class'][] = $base . '-input';
break;
default:
$args['class'][] = 'form-group mb-3';
$args['input_class'][] = 'form-control';
break;
} // End of switch ( $args ).
return $args;
}
}

if ( ! function_exists( 'understrap_wc_form_field_radio' ) ) {
/**
* Adjust the WooCommerce checkout/address radio fields to match the look of
* Bootstrap radio fields.
*
* Wraps each radio field (`<input>`+`<label>`) in a `.from-check`.
*
* If `$args['label']` is set a `<label>` tag is prepended to the radio
* fields. `$args['label_class']` is used for the class attribute of this
* tag and the class attribute of the actual input labels. Hence, we must
* remove the first occurance of the label class added via
* `understrap_wc_form_field_args()` that is meant for input labels only.
*
* @param string $field The field's HTML incl. the wrapper element.
* @param string $key The wrapper element's id attribute value.
* @param array<string|mixed> $args An array of field arguments.
* @param string|null $value The field's value.
* @return string
*/
function understrap_wc_form_field_radio( $field, $key, $args, $value ) {

// Set up Bootstrap version specific variables.
if ( 'bootstrap4' === get_theme_mod( 'understrap_bootstrap_version', 'bootstrap4' ) ) {
$wrapper_classes = 'custom-control custom-radio';
$label_class = 'custom-control-label';
} else {
$wrapper_classes = 'form-check';
$label_class = 'form-check-label';
}

// Remove the first occurance of the label class if neccessary.
if ( isset( $args['label'] ) && isset( $args['label_class'] ) ) {
$strpos = strpos( $field, $label_class );
if ( false !== $strpos ) {
$field = substr_replace( $field, '', $strpos, strlen( $label_class ) );

/*
* If $label_class was the only class in $args['label_class']
* then there is an empty class attribute now. Let's remove it.
*/
$field = str_replace( 'class=""', '', $field );
}
}

// Wrap each radio in a <span.from-check>.
$field = str_replace( '<input', "<span class=\"{$wrapper_classes}\"><input", $field );
$field = str_replace( '</label>', '</label></span>', $field );
if ( isset( $args['label'] ) ) {
// Remove the closing span tag from the first <label> element.
$strpos = strpos( $field, '</label>' ) + strlen( '</label>' );
$field = substr_replace( $field, '', $strpos, strlen( '</span>' ) );
}

return $field;
}
}

if ( ! is_admin() && ! function_exists( 'wc_review_ratings_enabled' ) ) {
/**
* Check if reviews are enabled.
Expand Down
Binary file modified languages/de_DE.mo
Binary file not shown.

0 comments on commit 21892f9

Please sign in to comment.