Hi there,
is it possible to link to a custom tab? In this case tab-custom_tab – for example http://www.forthree.com/basketball/single-layer-shirt-schwarz-basketballtrikot/ “Größenangaben in cm”. I would like to make a standard link on the respective item saying “item-url/#tab-tab-custom”
Thx in advance
Max
Hey,
Try adding this to your theme / child theme functions.php:
function add_custom_script(){
?>
<script>
if ( location.href.match(/#tab-tab-custom/) !== null ) {
jQuery( '#tab-tab-custom' ).show();
jQuery( 'li.tab-custom_tab a' ).trigger('click');
}
</script>
<?php
}
add_action('wp_footer', 'add_custom_script');
Then link it this way:
http://www.forthree.com/basketball/single-layer-shirt-schwarz-basketballtrikot/#tab-tab-custom/
Best regards,
Josue
i cannot see your answer after “Then link it this way:”
I edited the reply.
sorry it did not work
Hi,
Try with this instead;
function add_custom_script(){
?>
<script>
(function($){
$(window).load(function() {
if ( location.href.match(/#tab-tab-custom/) !== null ) {
$( '#tab-tab-custom' ).show();
$( 'li.tab-custom_tab a' ).trigger('click');
}
});
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'add_custom_script');
Regards,
Josue
thank you