ensure variable is of type string

This commit is contained in:
IanDelMar 2022-07-21 02:15:50 +02:00
parent 20b05b36f8
commit 39d30e2346
4 changed files with 20 additions and 5 deletions

View File

@ -44,6 +44,9 @@ if ( ! function_exists( 'understrap_generate_color_palette' ) ) {
$color_palette_json = json_decode( $color_palette_json, true );
if ( is_array( $color_palette_json ) ) {
foreach ( $color_palette_json as $key => $value ) {
if ( ! is_string( $key ) ) {
continue;
}
$key = str_replace( array( '--bs-', '--' ), '', $key );
$color_palette[] = array(
'name' => $key,

View File

@ -97,7 +97,11 @@ if ( ! function_exists( 'understrap_comment_form_comments_closed' ) ) {
* Displays a note that comments are closed if comments are closed and there are comments.
*/
function understrap_comment_form_comments_closed() {
if ( get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) {
$post_type = get_post_type();
if ( false === $post_type ) {
return;
}
if ( get_comments_number() && post_type_supports( $post_type, 'comments' ) ) {
?>
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'understrap' ); ?></p>
<?php

View File

@ -47,11 +47,15 @@ if ( ! function_exists( 'understrap_components_infinite_scroll_render' ) ) {
function understrap_components_infinite_scroll_render() {
while ( have_posts() ) {
the_post();
if ( is_search() ) :
if ( is_search() ) {
get_template_part( 'loop-templates/content', 'search' );
else :
get_template_part( 'loop-templates/content', get_post_format() );
endif;
} else {
$post_format = get_post_format();
if ( false === $post_format ) {
$post_format = '';
}
get_template_part( 'loop-templates/content', $post_format );
}
}
}
}

View File

@ -41,6 +41,10 @@ if ( ! function_exists( 'understrap_woocommerce_wrapper_start' ) ) {
*/
function understrap_woocommerce_wrapper_start() {
$container = get_theme_mod( 'understrap_container_type' );
if ( false === $container ) {
$container = '';
}
echo '<div class="wrapper" id="woocommerce-wrapper">';
echo '<div class="' . esc_attr( $container ) . '" id="content" tabindex="-1">';
echo '<div class="row">';