Created
June 27, 2024 11:24
-
-
Save jmabbas/32fa3eeee06ff98c1222cb320eaab1ba to your computer and use it in GitHub Desktop.
Vodi - Hide tab tittle there is no movies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function vc_child_hide_person_tabs_there_is_no_content() { ?> | |
<script> | |
document.addEventListener('DOMContentLoaded', function() { | |
function hasRequiredContent(tabPane, requiredClass) { | |
return tabPane.querySelector('.' + requiredClass) !== null; | |
} | |
const tabPanes = document.querySelectorAll('.tab-content > .tab-pane'); | |
const navItems = document.querySelectorAll('.nav > .nav-item'); | |
if (hasRequiredContent(tabPanes[1], 'person-cast-movie')) { | |
navItems[1].style.display = 'flex'; // Show the second nav item | |
} else { | |
navItems[1].style.display = 'none'; // Show the second nav item | |
} | |
if (hasRequiredContent(tabPanes[2], 'person-cast-tv-show')) { | |
navItems[2].style.display = 'flex'; // Show the third nav item | |
} else { | |
navItems[2].style.display = 'none'; // Show the second nav item | |
} | |
}); | |
</script> | |
<?php } | |
add_action( 'wp_head', 'vc_child_hide_person_tabs_there_is_no_content', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment