Snippets: Add Custom WPBakery Section/Row Divider Types/Styles

/**
 * Define new divider option.
 *
 * @see Total/framework/functions/shape-dividers.php
 */
add_filter( 'wpex_get_shape_divider_types', function( $types ) {
	$types['my-custom-divider'] = esc_html( 'Custom Divider', 'text_domain' );
	return $types;
} );

/**
 * Custom divider SVG.
 * Note: Since these are custom, the module settings for color, height, etc won't work.
 * to make those work you would need to generate the code and apply to your SVG
 * see the "wpex_get_shape_dividers_svg" function.
 * In Total 5.0.6 the $svg_styles_html and $path_attrs_html variables were added to the filter.
 *
 * @see Total/framework/functions/shape-dividers.php
 */
add_filter( 'wpex_get_shape_dividers_svg', function( $svg, $type, $settings ) {

	// Custom Divider SVG output
	if ( 'my-custom-divider' == $type ) {

		// Inverted SVG code
		if ( ! empty( $settings[ 'invert' ] ) && 'true' == $settings[ 'invert' ] ) {
			$svg = '<svg></svg>';
		}

		// Standard SVG code
		else {
			$svg = '<svg></svg>';
		}
	}

	return $svg;

}, 10, 3 );

Snippet Type: PHP

All PHP snippets should be added via a child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)