WC_Shortcodes::shortcode_wrapper( string[] $function, array $atts = array(), array $wrapper = array('class' => 'woocommerce', 'before' => null, 'after' => null) )
Shortcode Wrapper.
Description Description
Parameters Parameters
- $function
-
(Required) Callback function.
- $atts
-
(Optional) Attributes. Default to empty array.
Default value: array()
- $wrapper
-
(Optional) Customer wrapper data.
Default value: array('class' => 'woocommerce', 'before' => null, 'after' => null)
Return Return
(string)
Source Source
File: includes/class-wc-shortcodes.php
public static function shortcode_wrapper( $function, $atts = array(), $wrapper = array( 'class' => 'woocommerce', 'before' => null, 'after' => null, ) ) { ob_start(); // @codingStandardsIgnoreStart echo empty( $wrapper['before'] ) ? '<div class="' . esc_attr( $wrapper['class'] ) . '">' : $wrapper['before']; call_user_func( $function, $atts ); echo empty( $wrapper['after'] ) ? '</div>' : $wrapper['after']; // @codingStandardsIgnoreEnd return ob_get_clean(); }