Skip to content

Instantly share code, notes, and snippets.

View garretthyder's full-sized avatar
🗞️
Working away

Garrett Hyder garretthyder

🗞️
Working away
View GitHub Profile
@garretthyder
garretthyder / editor.js
Created January 20, 2020 23:01
WPMVC editor.js for blocks
/**
* Gutenberg block type.
* WPMVC block for gutenberg.
*
* @author Alejandro Mostajo <http://about.me/amostajo>
* @copyright 10Quality <http://www.10quality.com>
* @license MIT
* @package WPMVC\MyApp
* @version 1.0.0
*/
@garretthyder
garretthyder / BlockController.php
Created January 20, 2020 22:53
BlockController for WPMVC
<?php
namespace MyApp\Controllers;
use WPMVC\MVC\Controller;
/**
* BlockController controller.
*
*
@garretthyder
garretthyder / acf-intl-tel-required-in-conditional-group.js
Last active October 15, 2019 23:10
Enable Support for Required Intl-Tel fields in Groups that are conditionally shown
// Support ACF Intl Tel Address when in conditional group
jQuery(document).ready(function ($) {
$('[data-hiddeninput]').each(function() {
if ( $(this).is(":visible") ) {
$(this).prop('disabled', false);
$(this).removeAttr('disabled');
} else {
$(this).prop('disabled');
$(this).attr('disabled', 'disabled');
@garretthyder
garretthyder / revert-react-photomosaic.php
Created February 4, 2019 18:19
Revert React for Photomosaic
<?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);
@garretthyder
garretthyder / gulpfile.js
Last active December 3, 2018 05:02
JWP Gulpfile for #387
// 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')();
@garretthyder
garretthyder / cptui-enable-nonpublic-posttypes.php
Created June 14, 2018 06:38
CPTUI - Enable Non-Public Post Types in Taxonomy creation
<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' );
@garretthyder
garretthyder / functions.php
Last active March 1, 2018 06:06
Yoast SEO - Copy from Snippet
<?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' );
@garretthyder
garretthyder / gform_ajax_nojs.js
Created February 27, 2018 19:58
No-JS Support for Gravity Forms AJAX
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');
}
@garretthyder
garretthyder / foundation.accordion.js
Last active June 8, 2017 20:44
Foundation Accordion script w/ fixed Deeplinking for 6.3.1
'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;
@garretthyder
garretthyder / scssphp-compiler.php
Created November 2, 2016 23:02
PHP SCSS Compiler for ACF Options using Leafo's SCSSPHP
<?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() {