Skip Navigation

[Résolu] I would like to open a layout tab from a link on another page

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created Il y a 6 années et 11 mois. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 2 réponses, has 2 voix.

Last updated by Derek Il y a 6 années et 11 mois.

Assisted by: Nigel.

Auteur
Publications
#528507

I am trying to: link to a tab on a layout page from a different page

From this I was able to get a shortcut link to the tab from the same page: https://toolset.com/forums/topic/layout-tabs-id-keeps-changing/

See here: hidden link

I would like to have a similar link on listings pages.

#528677

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+01:00)

Hi Derek

Because the IDs change with every page load it is not possible to link to a particular tab from a different page because it is impossible to anticipate what the id will be when the link is followed and the page then loads.

If this was a must-have then you would need a slightly more elaborate solution. Your links on the first page would need to include a URL parameter to pass which tab is required to the target page (e.g. site.com/the-linked-page/?tab=3) and then on the target page add some jQuery that, when the page loads, looks for the existence of the tab parameter, and if present triggers updating the tabs, much like in the post you linked to.

Is that something you are able to write? It's outside of our support policy to write such custom code but if you need help and I have time I'll come back to it.

#529410

Thanks for pointing me in the right direction. It may not be super elegant but I have a workable solution:

jQuery(document).ready(function($){

$('#myModal').on('shown.bs.modal', function () {
$('#myInput').focus();

});
// To open the 2nd tab
$('.tb_1_btnyes').click(function(){

jQuery('.nav-tabs li:eq(1) a').click();
});

function GetURLParameter(sParam){
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}

if (GetURLParameter('tickets')=='book'){
/*alert(GetURLParameter('tickets'));*/
jQuery('.nav-tabs li:eq(1) a').click();

}

});

example: hidden link

I did have a plugin clash which caused tab content to repeat below, I still have to debug that but pleased it works, thanks!

Derek

Le forum ‘Types Community Support’ est fermé à de nouveaux sujets et réponses.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.