beans_modify_widget_count

Modify widget count.

beans_modify_widget_count( string $content )

Return: (string) The modified widget content.

Parameters

NameTypeRequiredDefaultDescription
$contentstringtrue-The widget content.

Source

function beans_modify_widget_count( $content ) {

	$count = beans_output( 'beans_widget_count', '$1' );

	if ( true == beans_get( 'dropdown', beans_get_widget( 'options' ) ) ) {

		$output = $count;

	} else {

		$output = beans_open_markup( 'beans_widget_count', 'span', 'class=tm-count' );

			$output .= $count;

		$output .= beans_close_markup( 'beans_widget_count', 'span' );

	}

	// Keep closing tag to avoid overwriting the inline JavaScript.
	return preg_replace( '#>((\s| )\((.*)\))#', '>' . $output, $content );

}