led_notice_elements() ) // At least one notice has been activated. && $woocommerce_active // WooCommerce is active. && ( ! is_admin() || $is_editor ) // We are not in WP Admin. ) { return true; } return false; } /** * Get Product Widget Content. * * A general function to create markup for the new query types in the Products widget. * * @since 3.7.0 * @access private * * @param array $settings The widget settings. * @param string $type The query type to create content for. * @param string $title_hook The hook name to filter in the widget title. * @param string $title_key The control ID for the section title. * * @return mixed The content or false */ private static function get_product_widget_content( $settings, $type, $title_hook, $title_key = '' ) { add_filter( $title_hook, function ( $heading ) use ( $settings, $title_key ) { $title_text = isset( $settings[ $title_key ] ) ? $settings[ $title_key ] : ''; if ( ! empty( $title_text ) ) { return $title_text; } return $heading; }, 10, 1 ); ob_start(); $args = self::parse_product_widget_args( $settings, $type ); if ( 'related_products' === $type ) { woocommerce_related_products( $args ); } elseif ( 'upsells' === $type ) { woocommerce_upsell_display( $args['limit'], $args['columns'], $args['orderby'], $args['order'] ); } else { /** * We need to wrap this content in the 'woocommerce' class for the layout to have the correct styling. * Because this will only be used as a separate widget on the Cart page, * the normal 'woocommerce' div from the cart widget will be closed before this content. */ echo '
'; woocommerce_cross_sell_display( $args['limit'], $args['columns'], $args['orderby'], $args['order'] ); echo '
'; } $products_html = ob_get_clean(); remove_filter( $title_hook, function() {}, 10 ); if ( $products_html ) { $products_html = str_replace( '