Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DigitalEssence/84d4be3cf4cb8b5bde887288f0da5913 to your computer and use it in GitHub Desktop.
Save DigitalEssence/84d4be3cf4cb8b5bde887288f0da5913 to your computer and use it in GitHub Desktop.
WordPress - Enfold - PHP - Add Sticky button
// Add Header Code
function de_sticky_button() {
?>
<!-- Start of Sticky Button -->
<a href="https://www.givey.com/renewcrew" target="_blank" title="Click to donate" class="sticky-button">CLICK TO DONATE</a>
<!-- End of Sticky Button -->
<?php
}
add_action('wp_body_open', 'de_sticky_button');
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sticky Bar
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
a.sticky-button { background: #FAA819; color: white; text-transform: uppercase; padding: 0px 15px 15px 15px; outline: none; text-decoration: none; position: fixed; top: 50%; right: 0; height: 40px; line-height: 45px; -webkit-transform: rotate(90deg); -moz-transform: rotate(90deg); transform: rotate(90deg); -webkit-transform-origin: 100% 0%; -moz-transform-origin: 100% 0%; transform-origin: 100% 0%; z-index:1000; text-transform:uppercase; box-shadow: 0 2px 40px rgba(0,0,0,0.2);
}
a.sticky-button:hover {text-decoration:none; background:#09AD50; transition: .5s ease;}
@media only screen and (max-width: 766px) {
a.sticky-button {display:none;}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment