Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1436621

    Hello,
    I’m trying to replicate the “whatsapp me” button but I’d like to avoid using plugins that calls external javascript and stuff.
    So I was wondering if there is a way to fix an image in the same posizione (eg bottom:120px; right:20px) for the whole site and link that image.
    I’m trying to put it in the footer but other elements are above it and I’m not able to bring it above even changing the z-index.
    Any suggestion?
    Thank you

    #1436636

    Hey SurigliaStudio,

    Did you add the element in question to your site already? If so, then please post a link to where we can see it.

    Best regards,
    Rikard

    #1436647

    Hello Rikard,
    I just added the image on the site
    It’s in the footer as you can see
    and I assign it a class .wa_img

    #1436652

    can you put this in your child-theme functions.php:

    function insert_a_whatsapp_button() { 
    ?>
    <script>
    (function($){
    	$( '#top' ).append('<div class="whatsapp-button"><a href="https://wa.me/3483883844?text=Salve,%20vorrei%20chiedere%20informazioni" target="_blank"><img width="80" height="80" src="https://srgl.it/aom/wp-content/uploads/2024/03/whatsapp_img-80x80.png" class="image wp-image-864 wa_img attachment-thumbnail size-thumbnail" alt="" style="max-width: 100%; height: auto;" decoding="async" srcset="https://srgl.it/aom/wp-content/uploads/2024/03/whatsapp_img-80x80.png 80w, https://srgl.it/aom/wp-content/uploads/2024/03/whatsapp_img-36x36.png 36w, https://srgl.it/aom/wp-content/uploads/2024/03/whatsapp_img.png 149w" sizes="(max-width: 80px) 100vw, 80px"></a></div>');
    	$('.whatsapp-button').css({
    		"position": "fixed",
    		"bottom": "120px",
    		"right": "20px",
    		"z-index": "500",
    	})
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'insert_a_whatsapp_button');
    #1436666

    Hi,

    Thanks for the update. Did you try the code posted by @guenni007, and did you have any luck with it?

    Best regards,
    Rikard

    #1436681

    Hello,
    Thank you Guenni007, the code works fine for me :)
    You can close the ticket
    A

    #1436718

    Hi,

    Great, I’m glad to hear that you got it working. Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Fix an image in a position in every page’ is closed to new replies.