Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍👦
I'd have more time for coding if I wasn't a parent!

Cameron Jones cameronjonesweb

👨‍👦
I'd have more time for coding if I wasn't a parent!
View GitHub Profile
@davewarfel
davewarfel / default-wordpress-blocks-sass.scss
Last active Oct 8, 2020
WordPress Blocks Styles - Cleaned Up, Commented & Sassified
View default-wordpress-blocks-sass.scss
/**
* WordPress Blocks
*
* Default block styling included with WordPress core.
* Provides a better starting point for WordPress theme developers,
* especially when using Sass.
*
* @link https://github.com/WordPress/WordPress/blob/master/wp-includes/css/dist/block-library/style.css
*
* Most styles from the above file are included.
@EricBusch
EricBusch / deploy.sh
Last active Jun 4, 2019
Deploy your plugin to the WordPress.org SVN plugin repository from your GitHub Repository.
View deploy.sh
#! /bin/bash
#
# Script to deploy from Github to WordPress.org Plugin Repository
# A modification of a number of different sources:
# @link https://github.com/deanc/wordpress-plugin-git-svn
# @link https://github.com/GaryJones/wordpress-plugin-svn-deploy
# @link https://github.com/thenbrent/multisite-user-management/blob/master/deploy.sh
#
# Accompanying Tutorial Here:
# @link https://ericbusch.net/?p=106
@galbaras
galbaras / insert_ad_after_block.php
Last active Nov 22, 2017
Insert Google ad after specific top-level text block in WordPress post
View insert_ad_after_block.php
/*
* This code is for WordPress and should be used in functions.php of the active theme.
*
* Before using it, replace "ADVERTISER ID" with your own advertiser ID and "SLOT ID" with your own slot ID
* (you can get both in Google AdSense). For best results, use a reponsive ad unit.
*
* If your posts contain "pre", "noscript" or some other type of HTML block, add them to $block_tags.
*
* You can change the insertion point by changing $after_block.
*
@pento
pento / rainbow-bar.php
Last active Sep 26, 2017
WordPress Rainbow Bar
View rainbow-bar.php
<?php
/*
* Plugin Name: Rainbow Bar!
*/
function rainbow_bar() {
?>
<style type="text/css">
#wpadminbar {
@timothyjensen
timothyjensen / functions.php
Last active Oct 13, 2019
Retrieves all post meta data according to the structure in the $config array. Provides a convenient and more performant alternative to ACF's `get_field()`. This function is especially useful when working with ACF repeater and flexible content fields. See details at https://www.timjensen.us/acf-get-field-alternative.
View functions.php
<?php
/**
* Retrieves all post meta data according to the structure in the $config
* array.
*
* Provides a convenient and more performant alternative to ACF's
* `get_field()`.
*
* This function is especially useful when working with ACF repeater fields and
* flexible content layouts.
@OriginalEXE
OriginalEXE / pe-customize-controls.css
Last active Jun 23, 2020
Extending WordPress Customizer Panels and Sections to allow nesting
View pe-customize-controls.css
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent,
#customize-theme-controls .customize-pane-child.current-section-parent {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
}
@scottbuscemi
scottbuscemi / woo-gist.php
Created Jul 13, 2016
WooCommerce minimum order amount for subtotal only (don't include shipping+tax)
View woo-gist.php
// Add to your functions.php file
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );
function wc_minimum_order_amount() {
// Set this variable to specify a minimum order value
$minimum = 50;
if ( WC()->cart->subtotal < $minimum ) {
@irazasyed
irazasyed / weight-utility.php
Created Jan 8, 2016
PHP: Utility function for getting random values with weighting.
View weight-utility.php
<?php
/**
* getRandomWeightedElement()
* Utility function for getting random values with weighting.
* Pass in an associative array, such as array('A'=>5, 'B'=>45, 'C'=>50)
* An array like this means that "A" has a 5% chance of being selected, "B" 45%, and "C" 50%.
* The return value is the array key, A, B, or C in this case. Note that the values assigned
* do not have to be percentages. The values are simply relative to each other. If one value
* weight was 2, and the other weight of 1, the value with the weight of 2 has about a 66%
* chance of being selected. Also note that weights should be integers.
@spivurno
spivurno / gw-gravity-forms-skip-registration-for-logged-in-users.php
Last active Feb 20, 2020
Gravity Wiz // Gravity Forms // Skip Registration for Logged in Users
View gw-gravity-forms-skip-registration-for-logged-in-users.php
<?php
/**
* Skip Registration for Logged In Users
* http://gravitywiz.com/2012/04/24/skip-user-registration-for-logged-in-users/
* Works for GF User Registration 3.0 and greater.
*/
add_filter( 'gform_is_delayed_pre_process_feed', 'maybe_delay_feeds', 10, 4 );
function maybe_delay_feeds( $is_delayed, $form, $entry, $slug ) {
if ( is_user_logged_in() && $slug == 'gravityformsuserregistration' ) {
return gf_user_registration()->has_feed_type( 'create', $form );
@johnbillion
johnbillion / wp_mail.md
Last active May 6, 2020
WordPress Emails
View wp_mail.md

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here: https://github.com/johnbillion/wp_mail

You can’t perform that action at this time.