Skip to content

Instantly share code, notes, and snippets.

View djcowan's full-sized avatar
Unite

djcowan djcowan

Unite
View GitHub Profile
@igorbenic
igorbenic / code.php
Last active February 21, 2024 21:32
How to create WordPress Metaboxes with OOP
<?php
class IBenic_WordPress_Metabox extends WordPressSettings {
protected $title = '';
protected $slug = '';
protected $post_types = array();
@corsonr
corsonr / functions.php
Created September 28, 2016 08:33
Display WooCommerce product variations dropdown select on the shop page
<?php
// Display variations dropdowns on shop page for variable products
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' );
function woo_display_variation_dropdown_on_shop_page() {
global $product;
if( $product->is_type( 'variable' )) {
$dashicons = array(
'dashicons-menu',
'dashicons-dashboard',
'dashicons-admin-site',
'dashicons-admin-media',
'dashicons-admin-page',
'dashicons-admin-comments',
'dashicons-admin-appearance',
'dashicons-admin-plugins',
'dashicons-admin-users',
@jaredatch
jaredatch / functions.php
Last active October 12, 2024 21:26
WordPress Search Autocomplete using admin-ajax.php
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@alirezas
alirezas / fade.js
Created February 13, 2017 10:54
fadeIn & fadeOut in vanilla js
function fadeOut(el){
el.style.opacity = 1;
(function fade() {
if ((el.style.opacity -= .1) < 0) {
el.style.display = "none";
} else {
requestAnimationFrame(fade);
}
})();
@Miserlou
Miserlou / semantic-2.2.9.html
Created March 4, 2017 00:46
Semantic UI 2.2.9 CDN Starter
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>Semantic UI CDN</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.9/semantic.min.css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.9/semantic.min.js"></script>
</head>
<body>
@cwhittl
cwhittl / fetch_plugin.js
Created April 13, 2017 14:42
Using Fetch with Wordpress Plugins Ajax
fetch(ajax_url, {
method: 'POST',
credentials: 'same-origin',
headers: new Headers({'Content-Type': 'application/x-www-form-urlencoded'}),
body: 'action=zget_profile_user'
})
.then((resp) => resp.json())
.then(function(data) {
if(data.status == "success"){
_this.setState({loaded:true,user:data.user});
@jmsdnns
jmsdnns / jd-export.jsx
Last active May 1, 2024 21:14
Illustrator script—Exports CMYK, RGB, and Hex values for all the color swatches in a document. CMYK to RGB conversion using Adobe’s default US Web Coated SWOP2 to sRGB.
/**
* jd-export.jsx
* -------------
* Illustrator script—Exports CMYK, RGB, and Hex values for all the color
* swatches in a document. CMYK to RGB conversion using Adobe’s default US
* Web Coated SWOP2 to sRGB.
*
*
* LICENSE
* -------
@larsmqller
larsmqller / wootriggersCartCheckout.js
Created September 22, 2018 14:50
Woocommerce cart and checkout triggers
//Cart
//https://github.com/woocommerce/woocommerce/blob/d30c54ef846b086b96278375b71f7c379d9aa8e8/assets/js/frontend/cart.js
$( document.body ).on( 'update_checkout', function(){});
$( document.body ).on( 'updated_cart_totals', function(){});
$( document.body ).on( 'updated_wc_div', function(){});
$( document.body ).on( 'updated_shipping_method', function(){});
$( document.body ).on( 'applied_coupon', function(){});
$( document.body ).on( 'removed_coupon', function(){});
// Checkout
@wpmudev-sls
wpmudev-sls / forminator-entry-id-in-response.php
Last active September 8, 2024 03:41
[Forminator] - Submission id in response messag. This snippet allows to use the submission id in response messages. The following macro can be used in the content `{submission_id}`
<?php
/**
* Plugin Name: [Forminator] - Submission id in response message
* Plugin URI: https://premium.wpmudev.org/
* Description: This snippet allows to use the submission id in response messages. The following macro can be used in the content `{submission_id}`
* Author: Panos Lyrakis, Amit Sonkhiya @ WPMUDEV
* Author URI: https://premium.wpmudev.org/
* Task: SLS-2683
* License: GPLv2 or later
*/