0

I use bootstrap to create the static site. In my home page i have a link to redirect to specific tab of another page. I use this script code, it works perfect in bootstrap static html page. Code in JS

    $(function() {
    var hash = window.location.hash;

    hash && $('ul.nav a[href="' + hash + '"]').tab('show');
});

Code in Html

<a href="tyres.html#menu7">

It will redirect page to tyre.htmil tab menu7, work perfect.

Once I move the html to themes of wordpress, this function does not work properly in php. it only redirect to the page, not on specific tab anymore.

Code i tried in php of home page of wordpress

<a href="tyres#menu7">

and

 <a href="tyres.php#menu7">

Do i need to replace Permalink name to ID? or what is right format i need to use in php? or if there is anything i need to change of my JS code?

Thanks

j08691
  • 204,283
  • 31
  • 260
  • 272

2 Answers2

0

Try using this instead

<a href="/tyres/#menu7" data-toggle="tab">
0

Try using the wordpress site_url(); function in the anchor tag like this to redirect and open the tab on destination page

<a href="<?php echo site_url(); ?>/your-page#tab-hash">
Vatsh Patel
  • 101
  • 7