Add a $wrapper parameter to the `shortcode_wrapper()` helper function with a default of `div.woocommerce`. Line 1601

This commit is contained in:
Brian Feister 2012-11-13 18:22:53 -05:00
parent ed625d25ef
commit dedc3fd0a4
1 changed files with 66 additions and 44 deletions

View File

@ -1598,9 +1598,31 @@ class Woocommerce {
* @param array $atts (default: array()) * @param array $atts (default: array())
* @return string * @return string
*/ */
function shortcode_wrapper( $function, $atts = array() ) { function shortcode_wrapper(
$function,
$wrapper = array(
'class' => 'woocommerce',
'before' => null,
'after' => null
)
$atts = array()
){
ob_start(); ob_start();
if( $wrapper['before'] == null && $wrapper['after'] == null ) :
echo '<div class="' . $wrapper['class'] . '">';
else:
echo $wrapper['before'];
endif;
call_user_func( $function, $atts ); call_user_func( $function, $atts );
if( $wrapper['before'] == null && $wrapper['after'] == null ) :
echo '</div>';
else:
echo $wrapper['after'];
endif;
return ob_get_clean(); return ob_get_clean();
} }