- http://bryanbarrera.com
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 | |
/* | |
This removes the Wordpress Logo from the admin dashboard | |
Add this snippet to the functions.php file within your theme | |
*/ | |
function remove_wordpress_logo() { | |
global $wp_admin_bar; | |
$wp_admin_bar->remove_menu('wp-logo'); | |
} | |
add_action('wp_before_admin_bar_render', 'remove_wordpress_logo', 0); |
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
// Scroll To Top | |
jQuery("a[href='#top']").click(function () { | |
jQuery("html, body").animate({ | |
scrollTop: 0 | |
}, "slow"); | |
return false; | |
}); | |
// hide button | |
jQuery('.elementBtn').hide(); |
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
// Show #element1 by default | |
// Show #element1 & #element2 by a unique url string | |
// -- | |
// ! #element2 is hiding by default with a class of `.hide` | |
// -- | |
// if the url string is `?sample=one` | |
// show `#element1` widget and hide the `#peakday` widget | |
if (location.search == "?sample=one") { | |
$('#element1').show(); |
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
// if we have anchor on the url | |
if (window.location.hash) { | |
// Store the window hash in a variable | |
var hashname = $(window.location.hash); | |
// smooth scroll to the id/hash/variable | |
$('html, body').animate({ | |
scrollTop: hashname.offset().top - 75 | |
}, 500); | |
} |
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
/* @import url('http://example.com/example_style.css'); */ | |
/** | |
* CSS @imports must be at the top of the file. | |
* Add them above this section. | |
*/ | |
/* ========================================================================== |
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
// Add this script after you make your dataLayer = []; call | |
// AND after your GTM code snippet | |
// This needs to go inside the header.php in order for it work globally across your site | |
<script type="text/javascript"> | |
// URL toolbox - helps grabbing elements in the URL | |
var _d = document; | |
var _dl = _d.location; | |
var _dlp = _dl.pathname; | |
var _dls = _dl.search; | |
var _dr = _d.referrer; |
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
// If "git remote -v" doesn't show you any remotes you can simply add a remote using: | |
// Replace https://username@stash/scm/PROJECT/repo.git with your repo URL | |
git remote add origin https://username@stash/scm/PROJECT/repo.git |
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 | |
/** | |
* The force_balance_tags() function ensures that no tags are left unclosed, | |
* while the wp_kses_post() ensures that only safe tags make it into the database | |
* (the same tags that are allowed in a standard WordPress post.) | |
* @param int $input. | |
* @return int sanitizes html input to display output. force_balance_tags checks to see if any html tags are unclosed. | |
*/ | |
function example_sanitize_text( $input ) { | |
return wp_kses_post( force_balance_tags( $input ) ); |
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 /** | |
* The force_balance_tags() function ensures that no tags are left unclosed, | |
* we're also using wp_kses to allow font awesome 'aria-hidden' tag to be allowed | |
* | |
* @param int $input. | |
* @return int sanitizes html input to display output. force_balance_tags checks to see if any html tags are unclosed. | |
*/ | |
function html_sanitize_text($input) { | |
$filtered = wp_kses($unfiltered, $allowed_html, $allowed_protocols); |
OlderNewer