I’m sure there are tons of plugins for adding Google Analytics to your WordPress site, and a lot of themes have an area for pasting scripts. But if you ever want to just add the code without any of that, the simplest way is in your functions.php: add_filter( ‘wp_print_footer_scripts’, function(){     ?>     <script>    […]

Below are some optimized SVGs I’ve made using the official assets provided by the companies.  Feel free to grab the code for your own projects.  Alternatively, checkout the plugin. [socialmonger size=’7vw’ color=’#f66′ align=center padding=’0 1ex’] https://twitter.com/sleepradio https://facebook.com/andrewklimek https://instagram.com/andrewklimek https://www.pinterest.com/ https://www.youtube.com/watch?v=WE8wBQBTkxQ https://plus.google.com/+andrewklimek https://www.linkedin.com/in/andrewklimek [/socialmonger] In case you’re not to familiar with SVGs, they are Vector Graphics […]

define( ‘WP_DEBUG’, true ); if ( WP_DEBUG ) { define( ‘WP_DEBUG_DISPLAY’, false ); define( ‘WP_DEBUG_LOG’, true ); @ini_set( ‘display_errors’, 0 ); define( ‘SCRIPT_DEBUG’, true ); }

JavaScript <script>   // auto tab   (function(){     var maxLengthInputs = document.querySelectorAll(‘#myform input[maxlength]’);     for(var i=0, l = maxLengthInputs.length; i<l; i++){         maxLengthInputs[i].addEventListener(‘input’, autotab );     }     function autotab(e){         if ( this.value.length == this.maxLength){             var allInputs = document.querySelectorAll(‘#myform input’);             var index = 1 + […]

add_filter(‘wp_mail_from’, function($email){     if( substr($email,0,10) === ‘wordpress@’)         $email = get_option(‘admin_email’);     return $email; }); add_filter(‘wp_mail_from_name’, function($name){     if($name === ‘WordPress’)         $name = str_replace( ‘’’, “‘”, get_option(‘blogname’) );     return $name; });

document.addEventListener(‘DOMContentLoaded’, function(){     function exitWarning(e){         e.preventDefault();     }     function setExitWarning(){         window.addEventListener(‘beforeunload’, exitWarning );         this.removeEventListener(‘change’, setExitWarning );     }     var forms = document.querySelectorAll(‘main form’);          for ( var i = 0, l = forms.length; i < l; i++ ) {         forms[i].addEventListener(‘change’, setExitWarning );    […]

This is a pretty goofy function, but a client once deleted the default user roles using some plugin, and I just threw this into functions.php to re-create them. It’s hooked onto admin_init, so it runs when you load any back-end page.  I set a transient that keeps the function from running more than once (and […]

function readycat_keygen( $atts ) {          extract( shortcode_atts(         array(             ‘len’ => null,             ‘char’ => ‘ABCDEFGHJKMNPQRSTUVWXYZ23456789’,// don’t bother with I L 1 O or 0             ‘type’ => ‘count’,             ‘countby’ => null,             ‘pre’ => null,            […]