Site logo

[Support request] Sticky Whatsapp icon on Mobile

Home Forums Support [Support request] Sticky Whatsapp icon on Mobile

Home Forums Support Sticky Whatsapp icon on Mobile

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #2484506
    Erwin

    Hello GP team,

    I like to make an icon on the mobile version of my website. The icon has to be in the right bottom corner and has to be sticky.

    – I have created a block element with a whatsapp icon (What hook should I use?)
    – How to make it sticky?

    Thank you in advance.

    #2484543
    David
    Staff
    Customer Support

    Hi there,

    can i see the block on your site ?

    #2485118
    Erwin

    Yes

    #2485307
    Fernando
    Customer Support

    Hi Erwin,

    Can you try adding this through Appearance > Customize > Additional CSS:

    .gb-container.gb-container-228de9bd {
        position: fixed;
        bottom: 0;
        right: 0;
    }

    Add this PHP snippet as well:

    add_filter( 'generate_element_display', function( $display, $element_id ) {
        if ( 100 === $element_id && ! is_wp_mobile() ) {
            $display = false;
        }
    
        return $display;
    }, 10, 2 );

    Replace 100 with the Block Element ID.

    Getting the Element ID: https://share.getcloudapp.com/YEuDdrnQ

    Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

    This code ensures that your Whatsapp button only appears on mobile devices.

    #2485700
    Erwin

    Hello Fernando, I have added your PHP snippet with php snippet plugin(including the element ID). Now I got a notification (back- and frontend):

    *translated: “A critical error has occurred on this site.”

    #2485758
    David
    Staff
    Customer Support

    Remove the PHP Snippet, its not required.
    Instead select the Container Block with the WhatsApp icon, and in Advanced > Additional CSS Class(es) add: hide-on-desktop hide-on-tablet

    #2485772
    Erwin

    Well, first I have to find out how to restore my website. I can’t login anymore…

    I have already hide it on dekstop and tablet in the container functions.

    #2485780
    Erwin

    The backup is restored. The CSS worked. Thanks

    #2485796
    David
    Staff
    Customer Support

    Ah sorry about that, glad to hear you got it working!

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.