Skip to content

Instantly share code, notes, and snippets.

View gbissland's full-sized avatar

Gareth gbissland

  • Weave Digital Studio
  • New Zealand
View GitHub Profile
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@getdave
getdave / gist:4578295
Last active January 30, 2024 06:34
Gravity Forms - custom field validation function for checkboxes. Ensures all checkboxes have been checked.
// Replace 7 with the ID of your form and 13 with the ID of the field you want to force "all required"
// http://www.gravityhelp.com/documentation/page/Gform_field_validation
add_filter("gform_field_validation_7_13", 'validate_tcs', 10, 4);
function validate_tcs($result, $value, $form, $field) {
// Convert the checkbox input name value (returned as part of "field")
// into the "underscored" ID version which is found in the $_POST
foreach ($field['inputs'] as $input) {
$input_post_value = 'input_' . str_replace('.', '_', $input['id']);
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@dabernathy89
dabernathy89 / gravity-forms-field-groups.php
Created March 13, 2013 19:55
Insert this script into functions.php in your WordPress theme (be cognizant of the opening and closing php tags) to allow field groups in Gravity Forms. The script will create two new field types - Open Group and Close Group. Add classes to your Open Group fields to style your groups. Note that there is a stray (but empty) <li> element created. …
<?php
/*
Insert this script into functions.php in your WordPress theme (be cognizant of the opening and closing php tags) to allow field groups in Gravity Forms. The script will create two new field types - Open Group and Close Group. Add classes to your Open Group fields to style your groups.
Note that there is a stray (but empty) <li> element created. It is given the class "fieldgroup_extra_li" so that you can hide it in your CSS if needed.
*/
add_filter("gform_add_field_buttons", "add_fieldgroup_fields");
function add_fieldgroup_fields($field_groups){
foreach($field_groups as &$group){
@BronsonQuick
BronsonQuick / gravity_forms_australian_formatted_address.php
Created May 13, 2013 01:57
Adds an Australian formatted Address dropdown to the Address field in Gravity Forms
function g8_aus_address( $address_types, $form_id ){
$address_types["australia"] = array(
"label" => "Australian",
"country" => "Australia",
"zip_label" => "Postcode",
"state_label" => "State",
"states" => array(
"NT" => "NT",
"ACT" => "ACT",
"NSW" => "NSW",
@isGabe
isGabe / wp-enqueue-gravity-forms-css.php
Created June 13, 2013 19:59
WordPress: register Gravity Forms stylsheet, only enqueue on Contact page #snippet #WordPress
// Gravity Forms style sheet
wp_register_style( 'gravity-forms', get_stylesheet_directory_uri() . '/library/css/gravity-forms.css', array(), '' );
// only load on contact page
if(is_page('contact')){
wp_enqueue_style('gravity-forms');
}
@ckpicker
ckpicker / gist:6357368
Created August 27, 2013 18:41
Community Events // Hide Venue & Organizer dropdowns on Community Add/Edit form
add_action( 'wp_footer', 'community_add_javascript' );
function community_add_javascript() {
if (tribe_is_community_edit_event_page()) {
?>
<script type="text/javascript">
//Hide venue dropdown
jQuery('#event_venue tr:first').hide();
//Hide organizer dropdown
@hisnipes
hisnipes / Wordpress GravityForms Google Spreadsheet Hook
Last active December 10, 2021 14:03
Wordpress GravityForms Google Spreadsheet Hook - dynamically populate radio button choices using data from a Google Spreadsheet (should allow for easier collaboration with non-tech colleagues). Matches with today's date to pull relevant information from the table. Thanks to Pamela Fox (parsing JSON output with PHP: https://gist.github.com/pamela…
<?
// Gravity Form Hook to SQL Database for Today's Dishes //
// the ### in gform_pre_render_### locates the id of your form //
add_filter('gform_pre_render_5', 'todays_dishes');
function todays_dishes($form){
foreach($form['fields'] as &$field){
@spivurno
spivurno / gw-gravity-forms-post-content-merge-tags-usage.php
Last active November 4, 2019 14:00
Gravity Wiz // Add Support for Gravity Form Merge Tags in your Post Content (when an entry ID is passed)
<?php
# Basic
gw_post_content_merge_tags();
# With Parameters
gw_post_content_merge_tags( array(
'auto_append_eid' => false,
'encrypt_eid' => true
) );
@wycks
wycks / remove-stuff.php
Created October 16, 2013 19:53
Remove stuff is removed from https://github.com/wycks/WP-Skeleton-Theme and is now here.
<?php
/**
* @package WordPress
* @subpackage WP-Skeleton
*/
// REMOVE SOME HEADER OUTPUT
function Wps_remove_header_info() {
remove_action('wp_head', 'rsd_link');