Last active
December 20, 2015 12:09
-
-
Save Shelob9/6129258 to your computer and use it in GitHub Desktop.
Function to create fixed position headers in WordPress. Assumes the header is wrapped in #header-wrap and site content to scroll underneath it is wrapped in #primary.
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 slug_header-Stick($options) { | |
echo "<style> #header-wrap(position:fixed;}"; | |
if (is_user_logged_in() ) { | |
echo "#header-wrap{ margin-top:19px; z-index:100; } </style>"; | |
} | |
echo "</style>" | |
echo " | |
<script> | |
jQuery(document).ready(function($) { | |
$('#primary').css('padding-top', $('#header-wrap').height() + 'px'); | |
}); //end no conflict wrapper | |
</script> | |
"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment