This time picker provides a unique way to enhance your input fields. Use a clock interface to enter the time. The plugin works with Bootstrap or standalone.
Part of my essentials :)
Datedropper is a jQuery Plugin that provides a quick and appealing interface to enter dates. Nice little plugin to spice up your interface.
Definitely part of my list of essentials :)
When loading web-fonts, we often see a brief un-styled moment before the browser applies the actual font. Gladly Typekit and also Google Web Fonts provide an option around that.
Both are using WebFont Loaders to help handle those brief moments.
TypeKit Webfont Loader Example
1 2 3 4 5 6 7 |
(function(d) { var config = { kitId: '***' , // Your Kit ID scriptTimeout: 3000 }, h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='//use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s) })(document); |
This adds a class name to the <html> element during loading
1 |
<html class="wf-loading"> |
This is removed when loading is done. This allows us to hide content until all fonts are loaded.
Webfonts Loading
1 2 3 |
.wf-loading * { opacity: 0; } |
This also adds classes once the webfonts have been loaded, which allows us to add some transitions to reveal the content again.
Webfonts Loaded
1 2 3 4 5 6 7 |
.wf-active *, .wf-inactive * { -webkit-transition: opacity 1s ease-out; -moz-transition: opacity 1s ease-out; -o-transition: opacity 1s ease-out; transition: opacity 1s ease-out; } |
One last thing. You should add the webfont loader early in your content, so that it can do its magic before anything else is being loaded.
Parent
1 2 3 4 5 |
var ParentView = Backbone.View.extend({ events: { 'click': 'onclick' } }); |
Child
1 2 3 4 5 6 7 8 |
var ChildView = ParentView.extend({ events: function(){ return _.extend({}, ParentView.prototype.events,{ 'click':'childClick', }); } }); |
Adding Metaboxes in WordPress to your admin areas normally involves 3 steps:
This can be done much easier using Custom Metaboxes and Fields for WordPress, which is a metabox, custom fields and forms library. The library provides a bunch of custom fields and also allows you to add your own easily. Much easier to build new Metaboxes fast!
List of field types included:
Simple example from the CMB2 Github page
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
if ( file_exists( __DIR__ . '/cmb2/init.php' ) ) { require_once __DIR__ . '/cmb2/init.php'; } elseif ( file_exists( __DIR__ . '/CMB2/init.php' ) ) { require_once __DIR__ . '/CMB2/init.php'; } add_action( 'cmb2_init', 'cmb2_sample_metaboxes' ); /** * Define the metabox and field configurations. */ function cmb2_sample_metaboxes() { // Start with an underscore to hide fields from custom fields list $prefix = '_yourprefix_'; /** * Initiate the metabox */ $cmb = new_cmb2_box( array( 'id' => 'test_metabox', 'title' => __( 'Test Metabox', 'cmb2' ), 'object_types' => array( 'page', ), // Post type 'context' => 'normal', 'priority' => 'high', 'show_names' => true, // Show field names on the left // 'cmb_styles' => false, // false to disable the CMB stylesheet // 'closed' => true, // Keep the metabox closed by default ) ); // Regular text field $cmb->add_field( array( 'name' => __( 'Test Text', 'cmb2' ), 'desc' => __( 'field description (optional)', 'cmb2' ), 'id' => $prefix . 'text', 'type' => 'text', 'show_on_cb' => 'cmb2_hide_if_no_cats', // function should return a bool value // 'sanitization_cb' => 'my_custom_sanitization', // custom sanitization callback parameter // 'escape_cb' => 'my_custom_escaping', // custom escaping callback parameter // 'on_front' => false, // Optionally designate a field to wp-admin only // 'repeatable' => true, ) ); } |
The current Google Analytics Dashboard for WordPress integrates no Opt-Out to disable tracking, which is required in Europe. Here is a workaround for that.
Paste this into your theme function.php.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
if ( !is_user_logged_in() && class_exists('GADWP_Manager') ) { add_action('wp_head', 'ga_optout_script', 1); } function ga_optout_script(){ // Read GA Dashboard Settings $options = (array) json_decode(get_option('gadash_options')); // Get GA Dashboard profiles foreach($options['ga_dash_profile_list'] as $profile){ $ga_ua_profile[$profile[1]] = $profile[2]; } // Get active Analytics profile for the current website $active = $options['ga_dash_tableid_jail']; $activeUA = $ga_ua_profile[$active]; // Add opt-out script + active UA echo "<script> var gaProperty = '".$activeUA."'; var disableStr = 'ga-disable-' + gaProperty; if (document.cookie.indexOf(disableStr + '=true') > -1) { window[disableStr] = true; } function gaOptout() { document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/'; window[disableStr] = true; } </script>"; } |
Then add this to your data privacy document:
1 |
<a href="javascript:gaOptout()">Disable Google Analytics tracking</a> |
When the defer attribute is present in the script tag, it specifies that the script is executed when the page has finished parsing. A requirement that is enforced by Google for example (Page-Speed ranking).
Currently the WordPress wp_enqueue_script provides no easy way to add new attributes, but there is a way around that :)
The below hack / filter needs to be added to your theme function.php. The filter should be your preferred solution, as the clean_url filter has been deprecated.
Make sure that your website / theme is still loading after adding these changes. If needed you can add more exceptions, as I did for jQuery.
Hack for WordPress before 4.1
1 2 3 4 5 6 7 8 |
if(is_admin() === FALSE){ function defer_parsing_of_js ( $url ) { if ( FALSE === strpos( $url, '.js' ) ) return $url; if ( strpos( $url, 'jquery.js' ) ) return $url; return "$url' defer "; } add_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 ); } |
Filter for WordPress 4.1+
Updated: 26.04.2015 – using clean Regexp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
if(is_admin() === FALSE){ function add_js_defer($tag, $handle, $src){ if( strpos( $tag, 'jquery.js' ) ) return $tag; preg_match_all('/([\w\-.:]+)\s*=\s*("[^"]*"|\'[^\']*\'|[\w\-.:]+)/i', $tag, $match); $newtag = "<script "; foreach($match[1] as $key=> $val){ $newtag .= $val."=".$match[2][$key]." "; } $newtag .= "defer></script>"; return $newtag.PHP_EOL; } add_filter( 'script_loader_tag', 'add_js_defer', 11, 1 ); } |
“countUp.js is a dependency-free, lightweight JavaScript “class” that can be used to quickly create animations that display numerical data in a more interesting way.”
1 |
$average_of_myfoos = array_sum($myfoos) / count($myfoos); |
1 2 |
var sum = myfoos.reduce(function(a, b) { return a + b; }); var avg = sum / myfoos.length; |
As part of our complete network upgrade, portalZINE.TV gets a complete facelift as well. The whole website has been streamlined in preparation for the new season.