Skip to content

Instantly share code, notes, and snippets.

View MichaelRise's full-sized avatar

Michael MichaelRise

View GitHub Profile
@MichaelRise
MichaelRise / bootstrap-collapse-slide-effect.js
Created July 31, 2019 21:03
Bootstrap collapse - Slide effect
// Bootstrap collapse slide effect
$('.collapse').on('show.bs.collapse', function(e) {
if( $('#'+this.id+'').hasClass('navbar-collapse') ){
$(document).find('#'+this.id+'').slideDown(500);
}
});
$('.collapse').on('hide.bs.collapse', function(e) {
if( $('#'+this.id+'').hasClass('navbar-collapse') ){
$(document).find('#'+this.id+'').slideUp(500);
@MichaelRise
MichaelRise / woocommerce_stock_status.php
Created July 13, 2018 15:42
Woocommerce - Add stock status to archive and single pages
/*
* Add stock status to archive and single pages
*
* WooCommerce Hooks: Actions and filters - https://docs.woocommerce.com/document/introduction-to-hooks-actions-and-filters/#
* Action and Filter Hook Reference - https://docs.woocommerce.com/wc-apidocs/hook-docs.html
*
*/
function woocommerce_stock_status() {
global $product;
@MichaelRise
MichaelRise / wp-checkbox-sanitization.php
Last active July 13, 2018 05:20
Wordpress checkbox sanitization
/**
* Checkbox sanitization
*
* @param bool int $input Whether the checkbox is checked.
* @return int Whether the checkbox is checked.
*/
function my_sanitize_checkbox( $input ) {
if( 1 == $input || true == $input ){
return 1;
} else {