Skip to content

Instantly share code, notes, and snippets.

@nciske
nciske / ie-sucks-fix.php
Last active August 29, 2015 13:56
Force IE 8 to not suck quite so much
<?php
// Tell IE to display content in the highest mode available
add_action( 'genesis_meta', 'force_ie_display_mode', 1 );
function force_ie_display_mode() {
echo '<meta http-equiv="X-UA-Compatible" content="IE=edge">';
}
<?php
//* Modify comments title text in comments
add_filter( 'genesis_title_comments', 'sp_genesis_title_comments' );
function sp_genesis_title_comments() {
ob_start();
comments_number( 'No Comments', '1 Comment', '% Comments' );
$title = '<h3>' . ob_get_contents() . '</h3>';
ob_end_clean();
return $title;
}
<?php
// THIS WORKS FINE
function sr_user_profile_update_email( $user_id, $old_user_data ) {
$user = get_userdata( $user_id );
if($old_user_data->user_email != $user->user_email) {
$admin_email = "chris@revelationconcept.com";
$message = sprintf( __( 'This user has updated their profile on the SchoolRise USA Staff Member site.' ) ) . "\r\n\r\n";
@nciske
nciske / EmbedUrl.php
Last active August 29, 2015 13:58
Add embed URL to SalesForce WordPress to Lead
<?php
/*
How to use:
1. Create a custom URL field at SalesForce
2. Replace URL_CUSTOM_FIELD_NAME below with the name of the custom field you setup in SalesForce,
it will be something like EmbedUrl__c
3. Add a hidden field to each form with the same field name (e.g. "EmbedUrl__c").
4. Make sure the hidden field is enabled (or it won’t be output with the form/get filled/be sent to SF).
5. Profit
@nciske
nciske / cpt-feed-disable.php
Created April 24, 2014 14:24
disable feeds for a specific CPT
<?php
add_action( 'init', 'register_cpt_test' );
function register_cpt_test() {
$labels = array(
'name' => _x( 'tests', 'test' ),
'singular_name' => _x( 'test', 'test' ),
'add_new' => _x( 'Add New', 'test' ),
'add_new_item' => _x( 'Add New test', 'test' ),
@nciske
nciske / urlparams.php
Last active August 29, 2015 14:01
Add some sanitization to avoid XSS issues. Based on http://plugins.svn.wordpress.org/url-params/tags/1.5/
<?php
/*
Plugin Name: URL Params
Plugin URI: http://asandia.com/wordpress-plugins/urlparams/
Description: Short Code to grab any URL Parameter
Version: 1.5.1
Author: Jeremy B. Shapiro
Author URI: http://www.asandia.com/
*/
@nciske
nciske / sf_w2l_user_ip.php
Last active August 29, 2015 14:01
Save user ip in a specific field -- replace user_ip__c with your custom field name - make sure it can store up to 45 characters (for IPv6 addresses)
<?php
// Save user ip in a specific field
// -- replace user_ip__c with your custom field name
// -- make that a hidden text field in your lead form (make sure it's enabled)
// -- make sure it can store up to 45 characters (for IPv6 addresses)
add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_ip_field', 10, 3 );
function salesforce_w2l_ip_field( $val, $field, $form ){
@nciske
nciske / plugin.php
Last active August 29, 2015 14:01
Fix for Genesis Simple Sidebars "Illegal string offset" error. Replace plugin.php with code below.
<?php
/*
Plugin Name: Genesis Simple Sidebars
Plugin URI: http://www.studiopress.com/plugins/simple-sidebars
Description: Genesis Simple Sidebars allows you to easily create and use new sidebar widget areas.
Author: Nathan Rice
Author URI: http://www.nathanrice.net/
Text Domain: ss
Domain Path: /languages/
<?php
function fix_pb_cover_image( $metadata, $object_id, $meta_key, $single ) {
if( isset( $meta_key ) && 'pb_cover_image' == $meta_key && is_ssl() )
return str_replace( 'http://', 'https://', $metadata );
return $metadata;
}
<?php
/*
How to use:
1. Create a custom field at SalesForce, long enough to hold your longest page title (i.e. at least 255 characters)
2. Replace PAGE_TITLE_CUSTOM_FIELD_NAME below with the name of the custom field you setup in SalesForce,
it will be something like PageTitle__c
3. Add a hidden field to your form(s) with the same field name (e.g. "PageTitle__c")
4. Profit
*/