Skip to content

Instantly share code, notes, and snippets.

View GarySwift's full-sized avatar

Gary Swift GarySwift

  • Waterford City, Ireland
View GitHub Profile
@GarySwift
GarySwift / app.js
Last active May 12, 2022 21:14
Cookie Reusable Component in ES6
import { cookies } from './lib/cookies';
import modal from './lib/modal';
$(document).ready(function() {
modal(cookies);
});
@GarySwift
GarySwift / app.js
Created May 12, 2022 21:09
Simple Reusable Components in ES6
import { helloWorld } from './lib/hello-world';
import sayHello from './lib/say-hello';
$(document).ready(function() {
sayHello(helloWorld);
// Hello Friend
});
@GarySwift
GarySwift / list_thumbnail_sizes.php
Last active December 17, 2020 10:25 — forked from twesolowski/list_thumbnail_sizes.php
Wordpress - get all defined thumbnail sizes
<?php
function list_thumbnail_sizes($type = 'all', $name = '') {
global $_wp_additional_image_sizes;
$sizes = array();
$rSizes = array();
foreach (get_intermediate_image_sizes() as $s) {
$sizes[$s] = array(0, 0);
if (in_array($s, array('thumbnail', 'medium', 'large'))) {
$sizes[$s][0] = get_option($s . '_size_w');
$sizes[$s][1] = get_option($s . '_size_h');
@GarySwift
GarySwift / acf-php-to-json.php
Created September 24, 2020 10:53 — forked from ollietreend/acf-php-to-json.php
Convert Advanced Custom Fields Pro configuration from PHP to JSON.
<?php
/**
* Plugin Name: Convert ACF PHP to JSON
* Description: Convert Advanced Custom Fields Pro configuration from PHP to JSON.
*/
namespace ConvertAcfPhpToJson;
/**
* Add submenu item under 'Custom Fields'
@GarySwift
GarySwift / register-post-type.php
Created January 21, 2020 11:00 — forked from justintadlock/register-post-type.php
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@GarySwift
GarySwift / EXPLANATION.md
Last active January 14, 2020 09:24
Hack to fix 'Undefined index: key' bug
@GarySwift
GarySwift / _.md
Last active May 14, 2021 07:10
Easily add sass and webpack support for WordPress plugins created using https://wppb.me/.

Add Sass and Webpack Support for WordPress plugins

This is for when you use the WordPress Plugin Boilerplate generator as starter for a WordPress plugin.

This is a way to get Sass set up and have Javascript use module dependency with webpack as the module bundler.

Follow the steps below to get started.

Steps

Icomoon Font Packs

These notes are a quick reminder to myself about how to install and how to update an Icomoon font pack.

https://icomoon.io/app/#/select

How to include in a FoundationPress project

Steps:
@GarySwift
GarySwift / gist:b5cf408c30257dd7efc3c8cae633e0cd
Last active May 25, 2018 10:35 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
@GarySwift
GarySwift / custom_menu_admin.php
Last active May 22, 2018 15:08 — forked from carlodaniele/custom_menu_admin.php
A basic plugin showing how to add menu metaboxes to admin menu page
<?php
/**
* @package Custom_menu_admin
* @version 1.0
*/
/*
Plugin Name: Custom menu admin
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Carlo Daniele