Home Forums WoodMart support forum MOBILE NAVBAR – JS SCRIPTS NO SUPPORTED AS CUSTOM LINK

MOBILE NAVBAR – JS SCRIPTS NO SUPPORTED AS CUSTOM LINK

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #139031

    Jeriss Cloud Center
    Participant

    Dear,

    In the header builder, I’ve been able to create a button whose link is defined as javascript:void(Tawk_API.toggle()) and you can test this button called “CHATTEZ AVEC NOUS” on my site (desktop view).

    Now I’m trying to create a similar button in the mobile navbar (mobile view) whose button shall be called “LIVE CHAT” and the link shall be exactly the same too. However, this is not working at all.

    The code I’m giving above is fully 100% working. You can have trust of this because if you go on the mobile sidebar, there is a link called “CHATTEZ AVEC NOUS” where there the code is working.

    Can you please tell me why the mobile navbar custom links does not support js script links? I need to make this work.

    Just for more information, here is the code behind the js script link :

    add_filter('walker_nav_menu_start_el', 'wpse_226884_replace_hash', 999);
    /**
     * Replace # with js
     * @param string $menu_item item HTML
     * @return string item HTML
     */
    function wpse_226884_replace_hash($menu_item) {
        if (strpos($menu_item, 'href="#"') !== false) {
            $menu_item = str_replace('href="#"', 'href="javascript:void(Tawk_API.toggle())"', $menu_item);
        }
        return $menu_item;
    }

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #139105

    Eric Watson
    Participant

    Hello,

    The URLs in our custom buttons are processed by function esc_url if you want you can find function woodmart_sticky_toolbar_custom_link_template in file woodmart\inc\modules\sticky-toolbar.php and change it as you need.

    http://prntscr.com/ough1l

    Kind Regards
    XTemos Studio

    #140120

    Jeriss Cloud Center
    Participant

    Thanks, please close this ticket

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘MOBILE NAVBAR – JS SCRIPTS NO SUPPORTED AS CUSTOM LINK’ is closed to new replies.