Skip to content

Instantly share code, notes, and snippets.

View djcowan's full-sized avatar

djcowan djcowan

View GitHub Profile
@phil-sola
phil-sola / block-filters.php
Created March 27, 2023 08:34
Gutenberg Core Query Loop Block Variation
<?php
// Filters the front-end output of the query block
function prefix_random_posts_block_variation( $pre_render, $block ) {
// Verify it's the block that should be modified using the namespace
if ( !empty($block['attrs']['namespace']) && 'namespace/random-ordered-posts' === $block[ 'attrs' ][ 'namespace' ] ) {
add_filter( 'query_loop_block_query_vars', function( $query ) {
$post = get_queried_object();
@SergioSNW
SergioSNW / adobe-fonts-for-gutenberg.php
Created October 27, 2021 10:19 — forked from madila/adobe-fonts-for-gutenberg.php
Add Adobe Fonts kit to WordPress new Editor
<?php
/*
Plugin Name: My Theme - Enqueue Adobe Fonts
Plugin URI: https://wordpress.org
Description: Must-use plugin for custom actions and filters to run for a site
Version: 0.1
Author: Ruben Madila
Author URI: https://rubenmadila.com
*/
@neno-tech
neno-tech / code.gs
Created May 20, 2021 02:46
CRUD Web App Full 2021
var sheetID = 'xxx'//แก้จุดที่1
function doGet(e) {
if (!e.parameter.page || e.parameter['page']=='index') {
var htmlOutput = HtmlService.createTemplateFromFile('index')
htmlOutput.message = '';
return htmlOutput.evaluate()
.setTitle("web app")
.addMetaTag('viewport', 'width=device-width , initial-scale=1')
.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL)
@wpmudev-sls
wpmudev-sls / forminator-entry-id-in-response.php
Last active February 23, 2024 02:32
[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
*/
@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
@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
* -------
@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});
@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>
@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);
}
})();
@jaredatch
jaredatch / functions.php
Last active July 3, 2023 23:10
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',