Skip to content

Instantly share code, notes, and snippets.

@kirandash
kirandash / Gravity Forms + Bootstrap
Created July 14, 2016 10:00
Helpful function for adding Bootstrap classes to Gravity Forms fields.
<?php
/**
* Gravity Forms Bootstrap Styles
*
* Applies bootstrap classes to various common field types.
* Requires Bootstrap to be in use by the theme.
*
* Using this function allows use of Gravity Forms default CSS
* in conjuction with Bootstrap (benefit for fields types such as Address).
*
@DaveyJake
DaveyJake / wp-rss2-image-enclosure.php
Last active January 12, 2024 16:28 — forked from supermethod/Wordpress RSS 2.0 image enclosure
WP RSS 2.0 Image Enclosure with File Size
<?php
/**
* Wordpress RSS Image Enclosure
*
* Wrap ONLY the featured image inside 'enclosure' tags.
*
* @author Davey Jacobson
* @link https://www.daveyjake.dev
*
* @package DJ_Dev
@mikejolley
mikejolley / ipn-test.php
Last active September 18, 2020 14:29
Quick snippet/plugin/dropin to test IPN support
<?php
/**
* Plugin Name: PayPal Sandbox IPN Tester
* Description: Pings the IPN endpoint to see if your server can connect. Just head to <a href="/?ipn-test=1">yoursite.com/?ipn-test=1</a> whilst logged in as admin.
* Version: 1.0.0
* Author: WooThemes
* Requires at least: 4.1
* Tested up to: 4.3
*/
if ( ! defined( 'ABSPATH' ) ) {
@jchristopher
jchristopher / gist:0cad8418fd9477c57b53
Last active January 18, 2022 13:39
Index WooCommerce product variation SKUs with the parent product
<?php
// index WooCommerce product_variation SKUs with the parent post
function my_searchwp_index_woocommerce_variation_skus( $extra_meta, $post_being_indexed ) {
// we only care about WooCommerce Products
if ( 'product' !== get_post_type( $post_being_indexed ) ) {
return $extra_meta;
}
@swas
swas / gist:10643194
Created April 14, 2014 12:25
PHP replacing special characters like à->a, è->e
// http://stackoverflow.com/questions/10152894/php-replacing-special-characters-like-a-a-e-e?answertab=votes#tab-top
// PHP.net User notes
<?php
$string = "ʿABBĀSĀBĀD";
echo iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $string);
// output: [nothing, and you get a notice]
echo iconv('UTF-8', 'ISO-8859-1//IGNORE', $string);
@hieblmedia
hieblmedia / .gitignore
Last active March 20, 2024 01:22
Gitignore - Exclude all except specific subdirectory
#
# If all files excluded and you will include only specific sub-directories
# the parent path must matched before.
#
/**
!/.gitignore
###############################
# Un-ignore the affected subdirectory
@spivurno
spivurno / gp-limit-choices-shared-limits.php
Last active March 11, 2021 22:03
Gravity Perks // GP Limit Choices // Share Limits Across Multiple Fields
<?php
/**
* Gravity Perks // GP Limit Choices // Share Limits Across Multiple Fields (and Forms)
*
* NOTE: This snippet only works with Gravity Forms 2.3 or greater.
*
* Adds support for specifying groups of fields which share the same limit. For example, if you had two fields with a
* limit of 10, selections from both fields would contribute to that limit.
*
* @version 2.1
@spivurno
spivurno / gp-limit-choices-spots-left.php
Last active July 18, 2020 00:27
Gravity Perks // GP Limit Choices // Display Spots Left in Choice Labels
<?php
/**
* Display how many spots are left in the choice label when using the GP Limit Choices perk
* http://gravitywiz.com/gravity-perks/
*/
add_filter( 'gplc_remove_choices', '__return_false' );
add_filter( 'gplc_pre_render_choice', 'my_add_how_many_left_message', 10, 5 );
<?php
/**
* A class filled with functions that will never go away upon theme deactivation
*
* @package WordPress
* @subpackage GRD
* @version 0.1.0
*/
class GRD_Functions {
@gregrickaby
gregrickaby / grd_functions.php
Last active April 10, 2018 02:38
A "must use" plugin to help save theme-agnostic functions
<?php
/**
* Must-Use Functions
*
* A class filled with functions that will never go away upon theme deactivation.
*
* @package WordPress
* @subpackage GRD
*/
class GRD_Functions {