Archived topic
suggestion feature svg
1 reply · Started by Sebastien on July 5, 2019
Hi,
This is about the new svg inline that you implement in the last version.
It would be very nice to be able to use a filter to customize the title of the svg <svg><title> customized title</title></svg> used in GP.
Or at least a filter to replace the full <svg></svg> in this case I could manage myself the title.
:)
see you !
Hi there,
That filter exists:
add_filter( 'generate_svg_icon', function( $output, $icon ) {
if ( 'menu-bars' === $icon ) {
$svg = 'your SVG code here';
$output = sprintf(
'<span class="gp-icon %1$s">%2$s</span>',
$icon,
$svg
);
}
return $output;
}, 10, 2 );
You can see the available icons to target here: https://github.com/tomusborne/generatepress/blob/2.3.2/inc/theme-functions.php#L235
Hope this helps :)