Open tabs with anchor links

Here’s a code snippet that should open vertical tabs using anchor links in the URL, eg: www.website.com/some-page/#open-3rd-tab . Simply paste this code into THEME options > Advanced > Custom JS :

// Javascript to enable link to tab
var zn_hash_url = document.location.toString();
if (zn_hash_url.match('#')) {
 jQuery('.tabbable a[data-toggle="tab"][href="#'+zn_hash_url.split('#')[1]+'"]').tab('show') ;
}

If you plan on adding into theme’s child theme’s custom JS file, make sure to wrap into document ready to have the DOM ready for the job:

jQuery( document ).ready(function() {
  .. code..
});