Skip to content

Instantly share code, notes, and snippets.

Garrett Hyder garrett-eclipse

View GitHub Profile
View revert-react-photomosaic.php
<?php
function revert_react() {
wp_deregister_script( 'react' );
wp_enqueue_script( 'react', '//cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.min.js', null, '0.13.3', true );
}
add_action('wp_enqueue_scripts', 'revert_react', 999);
@garrett-eclipse
garrett-eclipse / gulpfile.js
Last active Dec 3, 2018
JWP Gulpfile for #387
View gulpfile.js
// GULP PACKAGES
// Most packages are lazy loaded
var gulp = require('gulp'),
gutil = require('gulp-util'),
browserSync = require('browser-sync').create(),
filter = require('gulp-filter'),
touch = require('gulp-touch-cmd'),
plugin = require('gulp-load-plugins')();
@garrett-eclipse
garrett-eclipse / cptui-enable-nonpublic-posttypes.php
Created Jun 14, 2018
CPTUI - Enable Non-Public Post Types in Taxonomy creation
View cptui-enable-nonpublic-posttypes.php
<php
// CPTUI - Enable Non-Public Post Types
function enable_non_public_post_types( $args ) {
return array();
}
add_filter( 'cptui_attach_post_types_to_taxonomy', 'enable_non_public_post_types' );
@garrett-eclipse
garrett-eclipse / functions.php
Last active Mar 1, 2018
Yoast SEO - Copy from Snippet
View functions.php
<?php
function admin_scripts() {
// Adding Yoast Copy from Original Script
wp_register_script( 'yoastcopy-js', get_template_directory_uri() . '/assets/js/yoastcopy.js', array( 'jquery' ), '0.0.1', true );
wp_enqueue_script('yoastcopy-js');
}
add_action( 'admin_enqueue_scripts', 'admin_scripts' );
@garrett-eclipse
garrett-eclipse / gform_ajax_nojs.js
Created Feb 27, 2018
No-JS Support for Gravity Forms AJAX
View gform_ajax_nojs.js
jQuery(document).ready(function($) {
// Gravity Forms no-js support on Ajax
if ( $('.gform_wrapper form[data-target]').length ) {
$('.gform_wrapper form[data-target]').attr('target', $('.gform_wrapper form[data-target]').data('target'));
}
if ( $(".gform_wrapper input[name='nojs_gform_ajax']").length ) {
$(".gform_wrapper input[name='nojs_gform_ajax']").attr('name', 'gform_ajax');
}
@garrett-eclipse
garrett-eclipse / foundation.accordion.js
Last active Jun 8, 2017
Foundation Accordion script w/ fixed Deeplinking for 6.3.1
View foundation.accordion.js
'use strict';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
!function ($) {
// Custom Window Loaded Check
window.loaded = false;
@garrett-eclipse
garrett-eclipse / scssphp-compiler.php
Created Nov 2, 2016
PHP SCSS Compiler for ACF Options using Leafo's SCSSPHP
View scssphp-compiler.php
<?php
/** PHP SCSS Compiler
* @retrofit - https://github.com/ConnectThink/WP-SCSS
* @uses - http://leafo.github.io/scssphp
**/
if ( ! class_exists( 'scssc' ) ) {
include_once( get_template_directory() . '/vendor/scssphp/scss.inc.php' );
} elseif ( class_exists( 'Wp_Scss' ) ) {
// Add Admin notice to indicate WP-SCSS Plugin should be removed.
function wp_scss_installed_error_notice() {
@garrett-eclipse
garrett-eclipse / functions.php
Last active Sep 18, 2015 — forked from daithi-coombes/functions.php
To enable 'price from' and 'price to' search for wordpress [WP Property Plugin](https://usabilitydynamics.com/products/wp-property/forum/topic/price-range-search/)
View functions.php
/**
* Rename these to the form input names you are going to use.
* When you create a new attribute in Properties->Settings->Developer
* the form input name will appear greyed out under the attribute name
*/
define('SPRP_SEARCH_FROM_KEY', 'price_from_per_month');
define('SPRP_SEARCH_TO_KEY', 'price_to_per_month');
function parse_search(){
@garrett-eclipse
garrett-eclipse / woocommerce_emails_attach_downloadables.php
Created Aug 13, 2015
Add Downloadable Products to Woocommerce Completed Order & Invoice Emails as Attachments
View woocommerce_emails_attach_downloadables.php
<?php
// Add Downloadable Products to Woocommerce Completed Order & Invoice Emails as Attachments
function woocommerce_emails_attach_downloadables($attachments, $status, $order) {
if ( ! is_object( $order ) || ! isset( $status ) ) {
return $attachments;
}
if ( empty( $order ) ) {
return $attachments;
You can’t perform that action at this time.