Skip to content

Instantly share code, notes, and snippets.

@About2git
Forked from srikat/content.html
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save About2git/5fd0c21808cd6e0f4feb to your computer and use it in GitHub Desktop.

Select an option

Save About2git/5fd0c21808cd6e0f4feb to your computer and use it in GitHub Desktop.
How to use iCheck for customized check boxes and radio buttons in WordPress
<ul class="list">
<li><label><input type="checkbox" name="step1" value="Step 1"><span>Step 1</span></label></li>
<li><label><input type="checkbox" name="step2" value="Step 2"><span>Step 2</span></label></li>
</ul>
<?php
//* Do NOT include the opening php tag
//* Enqueue iCheck
add_action( 'wp_enqueue_scripts', 'sk_enqueue_icheck' );
function sk_enqueue_icheck() {
wp_enqueue_style( 'icheck-flat-green', get_stylesheet_directory_uri() . '/skins/flat/green.css' );
wp_enqueue_script( 'icheck', get_stylesheet_directory_uri() . '/js/icheck.min.js', array( 'jquery' ), '', true );
wp_enqueue_script( 'icheck-init', get_stylesheet_directory_uri() . '/js/icheck.init.js', array( 'icheck' ), '1.0.0', true );
}
jQuery(function( $ ){
$('input').iCheck({
checkboxClass: 'icheckbox_flat-green',
radioClass: 'iradio_flat-green'
});
});
.entry-title {
margin-bottom: 40px;
}
ul.list {
margin-left: 0;
}
.entry-content ul.list > li {
list-style: none;
margin-bottom: 10px;
}
.list span {
padding-left: 10px;
vertical-align: middle;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment