Home Forums WoodMart support forum REDIRECT ALL # URLS IN WOODMART THEME TO JAVASCRIPT LINK

REDIRECT ALL # URLS IN WOODMART THEME TO JAVASCRIPT LINK

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

    Jeriss Cloud Center
    Participant

    Dear,

    I’ve been able to modify the default WordPress behavior in such way that all urls stated as “#” are redirected to a javascript code. Please check below the code :

    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;
    }

    The redirection link itself is javascript:void(Tawk_API.toggle())
    I need to do the same for Woodmart urls. Can you help me make the same for Woodmart?

    Thanks for the help

    #139103

    Eric Watson
    Participant

    Hi,

    Sorry, but there is no such option in our theme by default. It may require additional code customization but we don’t have an instruction for this. It is out of our theme support scope.

    Regards

    #140122

    Jeriss Cloud Center
    Participant

    Thanks, please close this ticket

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

The topic ‘REDIRECT ALL # URLS IN WOODMART THEME TO JAVASCRIPT LINK’ is closed to new replies.