Paradiso Couture

Project notes

For this site, I created a child theme of Divi.

It has these additions to functions.php, at the bottom.

The first removes the Woocommerce sidebar

The second removes warning messages after updates

The third gives you three columns per Woocommerce page


/**
 * Remove Divi sidebar from all WooCommerce Product pages (as well as Shop and Category pages)
 */
function mytheme_divi_output_content_wrapper_end() {
	echo '
					</div> <!-- #left-area -->
				</div> <!-- #content-area -->
			</div> <!-- .container -->
		</div> <!-- #main-content -->';
}
function mytheme_remove_divi_sidebar() {
	remove_action( 'woocommerce_after_main_content', 'et_divi_output_content_wrapper_end', 10 );
	add_action( 'woocommerce_after_main_content', 'mytheme_divi_output_content_wrapper_end', 10 );	
}
add_action( 'init', 'mytheme_remove_divi_sidebar', 10 );

/**
 * Adjust the WooCommerce body classes for all WooCommerce Product pages (as well as Shop and Category pages)
 */
function mytheme_body_classes( $classes ) {
	if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
		$remove_classes = array('et_right_sidebar', 'et_left_sidebar', 'et_includes_sidebar');
		foreach( $classes as $key => $value ) {
		      if ( in_array( $value, $remove_classes ) ) unset( $classes[$key] );
		}
		$classes[] = 'et_full_width_page';
	}
	return $classes;
}
add_filter('body_class', 'mytheme_body_classes', 20);
// Call the function to install the warning suppressor
orbisius_p3778_warning_suppressor_supress_warnings();
 
/**
 * Installs an error handler that will be called only for php E_WARNING
 * @package Orbisius Warning Suppressor
 * @since 1.0
 */
function orbisius_p3778_warning_suppressor_supress_warnings() {
    // How to turn it off via wp-config.php
    if ( version_compare( phpversion(), 7, '>=' ) ) {
        // https://stackoverflow.com/questions/36079651/silence-declaration-should-be-compatible-warnings-in-php-7
        set_error_handler('orbisius_p3778_warning_suppressor_suppress_bad_warnings', E_WARNING);
    }
}
 
/**
 * Suppresses only the weird messages about the wrong/incorrect declaration.
 * @param int $err_no
 * @param str $err_str
 * @return bool
 */
function orbisius_p3778_warning_suppressor_suppress_bad_warnings($err_no, $err_str, $errfile = '', $errline = '') {
    // If the function returns FALSE then the normal error handler continues.
    $contains_stupid_warning = stripos($err_str, 'Declaration of') !== false;
    return $contains_stupid_warning;
}

/**
 * Change number or products per row to 3
 */
add_filter('loop_shop_columns', 'loop_columns', 999);
if (!function_exists('loop_columns')) {
	function loop_columns() {
		return 3; // 3 products per row
	}
}