Skip to content

Instantly share code, notes, and snippets.

View richardbuff's full-sized avatar

Richard Buff richardbuff

View GitHub Profile
@joshuadavidnelson
joshuadavidnelson / default-tax-archive-title.php
Last active March 29, 2018 20:46
Use Taxonomy Name for Default Taxonomy Archive Title in Genesis
<?php
/**
* Default Titles for Term Archives
*
* @author Bill Erickson
* @see http://www.billerickson.net/default-category-and-tag-titles
*
* @param string $headline
* @param object $term
* @return string $headline
@mikejolley
mikejolley / functions.php
Created April 14, 2016 18:07
WooCommerce - Disable ALL sale prices with code
<?php
/**
* After adding this code to theme functions.php, ensure you clear transients via WC > System Status > Tools
*/
add_filter( 'woocommerce_get_sale_price', '__return_empty_string' );
add_filter( 'woocommerce_variation_prices_sale_price', '__return_empty_string' );
add_filter( 'woocommerce_variation_prices_price', 'custom_get_price', 10, 2 );
add_filter( 'woocommerce_get_price', 'custom_get_price', 10, 2 );
@jtsternberg
jtsternberg / ajax-endpoint.js
Last active February 1, 2021 06:00
Proof of concept for avoiding admin-ajax for ajax callback requests. Also see Thomas Griffin's excellent post: https://thomasgriffin.io/a-creative-approach-to-efficient-and-scalable-wordpress-api-endpoints/ AND Josh Pollock's excellent post: http://torquemag.io/improved-wordpress-front-end-ajax-processing/
jQuery(document).ready(function($){
$('body').on( 'click', '.some-button', function(){
$.ajax( ajax_endpoint_data.api_url, {
type : 'POST',
dataType : 'json',
data : {
action: 'ajax_action',
some_data: 'some_value'
}
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@wpscholar
wpscholar / remote-media-loader.php
Last active April 5, 2022 08:57
Load media from a remote site so you don't have to download the uploads directory.
<?php
/**
* Loads media from a remote site when on a local dev environment.
* Eliminates the need to download the uploads directory from the remote site for testing purposes.
*/
if ( 'mydomain.dev' === $_SERVER['HTTP_HOST'] ):
add_filter( 'upload_dir', function ( $uploads ) {
$uploads['baseurl'] = 'http://mydomain.com/wp-content/uploads';
@webaware
webaware / gravity-forms-fields-above.php
Created May 12, 2014 03:39
Move Gravity Forms field labels from below to above fields in compound fields (e.g. Address, Name)
<?php
/*
Plugin Name: Gravity Forms Fields Above
Plugin URI: https://gist.github.com/webaware/24e1bacb47b76a6aee7f
Description: move field labels from below to above fields in compound fields (e.g. Address, Name)
Version: 1
Author: WebAware
Author URI: http://webaware.com.au/
@link http://www.gravityhelp.com/forums/topic/change-position-of-sub-labels-on-advanced-fields
@robneu
robneu / wordpress-typekit-enqueue.php
Last active January 17, 2023 23:04 — forked from FernE97/typekit-enqueue.php
Enqueue typekit fonts to WordPress using wp_enqueue_scripts.
<?php
/**
* Enqueue typekit fonts into WordPress using wp_enqueue_scripts.
*
* @author Robert Neu
* @author Eric Fernandez
* @copyright Copyright (c) 2014, Robert Neu
* @license GPL-2.0+
* @link http://typekit.com
*/