Site logo

Archived topic

How to add a custom SVG or img on sticky menu on mobile devices

1 reply · Started by FunkyCss on June 7, 2022

Viewing posts 1–2 of 2

Hi there,

So I am using this code to add a custom image for my slideout navigation menu togle



add_filter( 'generate_svg_icon', function( $output, $icon ) {
    if ( 'pro-menu-bars' === $icon ) {
        $output = '/wp-content/uploads/burgerMenu.png';
    }

    return $output;
}, 10, 2 );

And this works perfectly fine, but I need the same to add it to mobile - can you please tell me the filter name for this one ?

Thank you in advance

Hi there,

Try this:

add_filter( 'generate_svg_icon_element', function( $output, $icon ) {
    if ( 'menu-bars' === $icon ) {
        $output = '<svg>Your-custom-search-icon</svg>';
    }
    return $output;
}, 10, 2 );
This archived topic is closed to new replies.