REDIRECT ALL # URLS IN WOODMART THEME TO JAVASCRIPT LINK
-
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
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
Thanks, please close this ticket
The topic ‘REDIRECT ALL # URLS IN WOODMART THEME TO JAVASCRIPT LINK’ is closed to new replies.