-
-
Save lowegreg/694b50618e33dc137c92e6adba9eb6a4 to your computer and use it in GitHub Desktop.
Fix Select2 issues with WordPress Admin Bar
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 | |
add_action( 'wp_head', 'smyles_output_select2_admin_bar_fix' ); | |
function smyles_output_select2_admin_bar_fix() { | |
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type = "text/css"'; | |
/** | |
* We use ~ here instead of + for any situations where something else ends up attaching to body as well | |
*/ | |
?> | |
<style<?php echo $type_attr; ?> media="screen"> | |
div#wpadminbar ~ span.select2-container, body.admin-bar > span.select2-container { | |
padding-top: 32px !important; | |
} | |
@media screen and ( max-width: 782px ) { | |
div#wpadminbar ~ span.select2-container, body.admin-bar > span.select2-container { | |
padding-top: 46px !important; | |
} | |
} | |
</style> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment