Add a $wrapper parameter to the `shortcode_wrapper()` helper function with a default of `div.woocommerce`. Line 1601
This commit is contained in:
parent
ed625d25ef
commit
dedc3fd0a4
|
@ -1598,9 +1598,31 @@ class Woocommerce {
|
|||
* @param array $atts (default: array())
|
||||
* @return string
|
||||
*/
|
||||
function shortcode_wrapper( $function, $atts = array() ) {
|
||||
function shortcode_wrapper(
|
||||
$function,
|
||||
$wrapper = array(
|
||||
'class' => 'woocommerce',
|
||||
'before' => null,
|
||||
'after' => null
|
||||
)
|
||||
$atts = array()
|
||||
){
|
||||
ob_start();
|
||||
|
||||
if( $wrapper['before'] == null && $wrapper['after'] == null ) :
|
||||
echo '<div class="' . $wrapper['class'] . '">';
|
||||
else:
|
||||
echo $wrapper['before'];
|
||||
endif;
|
||||
|
||||
call_user_func( $function, $atts );
|
||||
|
||||
if( $wrapper['before'] == null && $wrapper['after'] == null ) :
|
||||
echo '</div>';
|
||||
else:
|
||||
echo $wrapper['after'];
|
||||
endif;
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue