Can't add custom shape layers to rows

#1

Hi!

Here is, svg file code:

<?php

/*Contents of the <svg> element with fl-shape class added */
?>
<g class="fl-shape" transform="matrix(1,0,0,1,-10,-38)">
    <clipPath id="_clip1">
        <rect x="10" y="38" width="172" height="85"/>
    </clipPath>
    <g clip-path="url(#_clip1)">
        <path d="M183.5,38C87.743,38 10,57.044 10,80.5C10,103.956 87.743,123 183.5,123C154.773,113.083 131.45,97.454 131.45,80.5C131.45,63.546 154.773,47.917 183.5,38Z" />
    </g>
</g>

and implementation function:

<?php
function bb_register_custom_shapes() {
	FLBuilder::register_shape(array(
		'label' => __( 'Boomerang', 'bb-custom-shapes-boomerang' ),
		'name' => 'boomerang',
		/* Optional x and y origin values, from SVG viewBox
		 ex: viewBox="x y width height" */
		// 'x' => 0,
		// 'y' => 0,
		/* Required width and height values from SVG definition */
		'width' => 347,
		'height' => 85,
		/* Optional aspect ratio setting, from the SVG element - see svg spec */
		// 'preserve_aspect_ratio' => 'none'
		/* Include the path to your artwork */
		'render' => FL_CHILD_THEME_DIR . '/shapes/boomerang.svg.php',
	));
}
add_action('fl_register_art', 'bb_register_custom_shapes');

FL_CHILD_THEME_DIR = /app/public/wp-content/themes/tropera/shapes/boomerang.svg.php

What could be failing? I have done many tests without success.

Thanks!

#2

Use the ‘init’ action :wink:

1 Like
#3

Jajajaja, sure! You’re right. Thanks for your help “twice”.

Have a great day!