Question: I have 3 php files content.php, functions.php and topics.php
I want that when a user clicks on an link in topics.php that they get redirected to a page with tab1 open and that on the same link but at different button that tab2 is open when they click on the link.

I have tried code with onClick="" and with jquery but none of that has worked.

The active tab must reflect where on the site the user has clicked (i.e. whether the user clicked the first 'Algebra' link or the second one).

The links are defined and created in topics.php

Answer: 
I have found the solution to my own question:

In functions.php I added the code:

```
function wwp_custom_query_vars_filter($vars) {
    $vars[] = 'tab';
    return $vars;
}
add_filter( 'query_vars', 'wwp_custom_query_vars_filter' );

```

And in the topics.php I added:

```
?var=variable1

```

To the url

and in content.php I added the conditions check by calling:

```
get_query_var('var');

```
In your case to load a link with specific tab as active you utilize your URL Hash more:

If you have this link: 

pockettutor.ie/algebra/#nav-y1

Then

```
<script language="javascript" type="text/javascript">
  if(window.location.hash) { // Check if url hash is not empty
      var hash = window.location.hash; // nav-y1
      document.querySelector('[href="'+hash+'"]').click();
  }
</script>

```