Skip to content

Instantly share code, notes, and snippets.

apiVersion: v1
data:
auth: <SECRET>
kind: Secret
metadata:
name: staging-basic-auth
type: Opaque
@melvinstanly
melvinstanly / woo-checkout-order-review.php
Created September 12, 2018 06:52
Add custom field or html to review order table in WooCommerce Checkout
<?php
/* To add custom field in order review table in checkout page, you will have to use some of the hooks listed below.
do_action( 'woocommerce_review_order_before_cart_contents' );
do_action( 'woocommerce_review_order_after_cart_contents' );
do_action( 'woocommerce_review_order_before_shipping' );
do_action( 'woocommerce_review_order_after_shipping' );
do_action( 'woocommerce_review_order_before_order_total' );
do_action( 'woocommerce_review_order_after_order_total' );
@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active January 21, 2024 16:28
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
@superpositif
superpositif / jp_sync_acf_fields.php
Last active March 23, 2023 14:20 — forked from nkkollaw/jp_sync_acf_fields.php
Automatically update Advanced Custom Fields field groups via JSON
<?php
/**
*
* Function that will automatically remove ACF field groups via JSON file update
*
*/
function slh_acf_auto_suppr($json_dirs) {
$groups = acf_get_field_groups();
if (empty($groups)) {
@conorbarclay
conorbarclay / GoogleMap.js
Last active August 19, 2018 07:41
WordPress + Google Map Workflow (using ACF field data)
/* global google */
import $ from 'jquery';
class GoogleMap {
constructor(el) {
this.el = $(el);
this.icon = {
path: 'M25,0C15.957,0,8.625,7.277,8.625,16.253C8.625,31.638,25,50,25,50s16.375-17.37,16.375-33.747 C41.375,7.277,34.044,0,25,0z M25,23.084c-3.383,0-6.125-2.742-6.125-6.125s2.742-6.125,6.125-6.125s6.125,2.742,6.125,6.125 S28.383,23.084,25,23.084z',
fillColor: '#ed1c2e',
fillOpacity: 1,
@rhukster
rhukster / sphp.sh
Last active March 30, 2024 10:41
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)
[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[ subject ]
@courtneymyers
courtneymyers / acf_modifications.php
Created February 28, 2018 18:36
Reduces initial height of Advanced Custom Fields WYSIWYG fields to 100px, and enables autoresizing of WYSIWYG field, as text is entered. Best practice would be to include this function in a site-specific plugin.
<?php
/*
* -----------------------------------------------------------------------------
* Advanced Custom Fields Modifications
* -----------------------------------------------------------------------------
*/
function PREFIX_apply_acf_modifications() {
?>
<style>
@ghosh
ghosh / micromodal.css
Last active July 28, 2024 00:43
Demo modal styles for micromodal.js and corresponding expected html. If using this, set the `awaitCloseAnimation` in config to true
/**************************\
Basic Modal Styles
\**************************/
.modal {
font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
}
.modal__overlay {
position: fixed;
@alokstha1
alokstha1 / functions.php
Created September 14, 2017 08:13
WordPress custom pagination with $wpdb->get_results
<?php
$items_per_page = 2;
$page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1;
$offset = ( $page * $items_per_page ) - $items_per_page;
$query = 'SELECT * FROM '.$table_name;
$total_query = "SELECT COUNT(1) FROM (${query}) AS combined_table";
$total = $wpdb->get_var( $total_query );