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)


Top ↑

Return Return

(string)


Top ↑

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();
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.