Last active
January 23, 2024 14:59
-
-
Save andrasguseo/a22cbb1917c98a9fbf5a47c012b37d76 to your computer and use it in GitHub Desktop.
Filter Bar > Open the Filter Bar on mobile on initial pageload
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
<?php | |
/** | |
* Open the Filter Bar on mobile on initial pageload. | |
* | |
* By default, Filter Bar is closed on mobile regardless of the setting. | |
* With this snippet Filter Bar will show on pageload when using the horizontal setup. | |
* | |
* Usage: Add the snippet to your functions.php file or with a plugin like Code Snippets. | |
* | |
* @author: Andras Guseo | |
* | |
* Plugins required: The Events Calendar, Filter Bar | |
* Created: January 19, 2024 | |
*/ | |
function tec_open_filterbar() { | |
echo '<script> | |
let fbSelector = document.querySelector(".tribe-filter-bar.tribe-filter-bar--horizontal"); | |
if(fbSelector != null) { | |
fbSelector.classList += " tribe-filter-bar--open"; | |
fbSelector.style.position = "unset"; | |
} | |
</script>'; | |
} | |
add_action( 'wp_footer', 'tec_open_filterbar' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment