Skip to content

Instantly share code, notes, and snippets.

View petertwise's full-sized avatar

Peter Wise petertwise

View GitHub Profile
<?php
/*
Plugin Name: Square Candy ACF RGB color output
Plugin URI: http://squarecandydesign.com
Description: provides a function to output RGB values from ACF colorpicker fields
Author: Peter Wise
Version: 0.1
Author URI: http://squarecandydesign.com
*/
@petertwise
petertwise / squarecandy-responsive-basics.js
Created April 11, 2017 15:14
Basic Load and Resize jQuery to start from
/***********
RESPONSIVE CALCULATIONS
**********/
// On the first time the page loads, or if the orientation changes
// (portrait to landscape, etc) call the recalculation script
$(window).on('load orientationchange', function(){
responsive_calc();
});
@petertwise
petertwise / addtogcal.php
Last active April 4, 2025 19:52
Function to create Add to Google Calendar link
<?php
/**
* Create a Google Calendar "add to calendar" link.
*
* This function is convienient because it does not require an API connection.
* Note that this only allows for adding a single event.
* The data does not have to exist already on any Google Calendar anywhere.
* This just adds your event data to the end-users GCal one item at a time.
* See https://stackoverflow.com/a/19867654/947370 for a full explaination of
* the Google Calendar URL structure.
@petertwise
petertwise / accordion.js
Created April 4, 2016 00:35
Square Candy jQuery Accordion
jQuery(document).ready(function($){
// accordion
$('.accordion_content').hide();
$('.accordion_item header h2').on('click', function(){
var accordionheader = $(this);
if (accordionheader.hasClass('accordion-open')) {
$('.accordion-open').removeClass('accordion-open');
accordionheader.parent().next().slideUp(500);
}
else {
@petertwise
petertwise / wp-cli-oneclick-install.sh
Last active February 3, 2025 13:00
Customized wordpress install script with WP CLI
#!/bin/bash
# Install Wordpress with Square Candy default using WP CLI
read -p 'Site URL (example.com): ' url
read -p 'Site Title: ' title
read -p 'WP Admin username: ' admin_user
read -sp 'WP Admin password: ' admin_password
read -p '
WP Admin email: ' admin_email
read -p 'Database name: ' dbname
read -p 'Database user: ' dbuser