Skip to content

Instantly share code, notes, and snippets.

@soderlind
soderlind / force-protocol-less-url.php
Last active January 28, 2016 22:23
remove http and https from links
<?php
//code from https://wordpress.org/plugins/cloudflare/
/**
* remove http and https from links, save in mu-plugins
*/
if (true !== function_exists('cloudflare_buffer_wrapup')) {
function cloudflare_buffer_wrapup($buffer) {
// Check for a Content-Type header. Currently only apply rewriting to "text/html" or undefined
//* Add Gravity Forms Permission for Editor
function add_grav_forms(){
$role = get_role('editor');
$role->add_cap('gform_full_access');
}
add_action('admin_init','add_grav_forms')
@cdils
cdils / functions.php
Created February 23, 2015 18:20
Add latest post revision date to Genesis post info.
<?php //remove this line
add_filter( 'genesis_post_info', 'cd_post_info_filter' );
function cd_post_info_filter( $post_info ) {
if ( ! is_singular( 'post' ) ) {
$post_info = '[post_date] by [post_author_posts_link] [post_comments]';
$post_modified_info = '[post_modified_date before="<br />Last updated "]';
return $post_info . $post_modified_info;
@growdev
growdev / gist:ad915038172511975fbd
Created December 3, 2014 20:03
Remove WooThemes Helper plugin nag
<?php
add_action( 'init', 'growdev_remove_woo_nag' );
/**
* Remove the admin notice nagging you to install/activate the WooThemes Helper plugin
* This notice should be dismissable, but isn't.
*
*/
function growdev_remove_woo_nag() {
remove_action( 'admin_notices', 'woothemes_updater_notice' );
<?
//=========================================================== SUBSCRIBER SHORTCODE
function subscriber_shortcode($atts, $content = null ) {
extract(shortcode_atts(array(
'page' => '',
'headline' => 'Subscribe for free updates',
'button' => 'Subscribe',
'quote' => '',
'class' => 'box_main',
'form_class' => 'centered_form',
For CSS
.attachment-thumbnail {
float: left;
padding: 10px;
}
For functions.php
@GaryJones
GaryJones / functions.php
Last active January 11, 2016 05:19
Default styles for HTML5 galleries and captions.
<?php
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
@robneu
robneu / gform-split-test.php
Last active January 2, 2016 10:19
Create an A/B Split test using GravityForms
<?php
/**
* Create a split test using two different GravityForms
*
* Allows you to test the effectiveness of two different forms by displaying each
* one 50% of the time. Tracking CTR using the built-in GravityForms functionality
* should give you an idea of which form is most effective.
*
* @uses GravityForms
* @author FAT Media, LLC
@robneu
robneu / disable-jetpack-modules.php
Last active April 25, 2016 20:27
Disable unwanted Jetpack Modules. The whitelist array will allow any modules you want to remain enabled to continue to function. If you don't want the module to activate, remove it from the whitelist.
<?php
add_filter( 'jetpack_get_available_modules', 'prefix_hide_jetpack_modules' );
/**
* Disable all non-whitelisted jetpack modules.
*
* As it's written, this will allow all of the currently available Jetpack
* modules to work display and be activated normally.
*
* If there's a module you'd like to disable, simply comment it out or remove it
* from the whitelist and it will no longer be available for activation.
@jg314
jg314 / gravity_forms_ga_tracking.php
Last active November 30, 2017 20:20
Add Google Analytics Ecommerce tracking to a donation form created through Gravity Forms.
<?php
/*
* Add custom query vars to handle Google Analytics Ecommerce tracking.
* This should be placed in a plugin or in functions.php of the theme.
*
* You'll want to use the redirect method for Gravity Forms confirmations and
* turn on passing field data via a query string. An example we used was:
* donation_amount={Donation Amount:13}&donation_id={entry_id}&donation_recurring=0
*/
function sm_add_query_vars( $vars ){