Skip to content

Instantly share code, notes, and snippets.

View styledev's full-sized avatar

Dewey Bushaw styledev

  • Speak4
  • Arlington, VA
View GitHub Profile
@styledev
styledev / gfcptaddonbase.diff
Created April 17, 2012 01:57
Gravity Forms + Custom Post Types Plugin - Dropdown Selected Feature
2012-04-18 12:13:43.378 osascript[26429:903] Error loading /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: dlopen(/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found. Did find:
/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: no matching architecture in universal wrapper
osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" declares no loadable handlers.
--- /Users/bushaw/Desktop/gravity-forms-custom-post-types/gfcptaddonbase.php
+++ gfcptaddonbase.php
@@ -246,21 +246,24 @@
*/
function setup_post_type_field( &$field, $post_type ) {
$first_choice = $field['choices'][0]['text'];
- $field['choices'] = $this->load_post_type_choices( $post_type, $first_choice );
@styledev
styledev / seo-friendly-images.php
Created May 14, 2012 23:50
Updated plugin file [fixes: wp_debug errors, variable misspelling, and code formatting]
<?php
/*
Plugin Name: SEO Friendly Images
Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/seo-friendly-images
Description: Automatically adds alt and title attributes to all your images. Improves traffic from search results and makes them W3C/xHTML valid as well.
Version: 2.7.0
Author: Vladimir Prelovac
Author URI: http://www.prelovac.com/vladimir
<?php
/**
* @package Order Up!
*/
/*
Plugin Name: Custom Taxonomy Order
Plugin URI: http://drewgourley.com/order-up-custom-ordering-for-wordpress/
Description: Allows for the ordering of categories and custom taxonomy terms through a simple drag-and-drop interface.
Version: 2.0
Author: Drew Gourley
2012-05-29 13:22:55.009 osascript[72787:903] Error loading /Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: dlopen(/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found. Did find:
/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit Types: no matching architecture in universal wrapper
osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" declares no loadable handlers.
--- /Users/bushaw/Downloads/gravity-forms-update-post/gravityforms-update-post.php
+++ gravityforms-update-post.php
@@ -126,6 +126,22 @@
}
public function gform_pre_render($form) {
+ ?>
@styledev
styledev / Parse Tweet Message to Link Entities
Last active March 24, 2016 16:24
This function will linkify your tweet messages from the Twitter API using include_entities=true
@styledev
styledev / acf.php
Created August 29, 2012 21:50
This code will upgrade ACF to allow for multi-item reverse loopkup by giving each relationship connection a 'rel_$post_type' meta_key with a serialized array of posts containing the post_ids of the originating post.
// Added "before_delete_post" action to trigger rel_cleanup (cleans up all associated posts with rel_ meta_keys when a post is deleted)
function Acf()
{
// vars
$this->path = plugin_dir_path(__FILE__);
$this->dir = plugins_url('',__FILE__);
$this->version = '3.3.9';
$this->upgrade_version = '3.3.3'; // this is the latest version which requires an upgrade
$this->cache = array(); // basic array cache to hold data throughout the page load
@styledev
styledev / Wordpress - Range Filter on Post Title
Created October 17, 2012 11:09
This will allow you to use /?range=a,e which will then return all posts with a post title that begins with an A,B,C,D,or E.
public function range_add($aVars) {
$aVars[] = "range";
return $aVars;
}
public function range_where( $where, $args ) {
if( !is_admin() ) {
$range = ( isset($args->query_vars['range']) ? $args->query_vars['range'] : false );
if( $range ) {
$range = split(',',$range);
$where .= "AND LEFT(wp_posts.post_title,1) BETWEEN '$range[0]' AND '$range[1]'";
@styledev
styledev / site.js
Created October 29, 2012 08:40
My jQuery file upload call [failing resize]
// Functions Go Here
$(function(){ // on ready code goes here
var form = $('.direct-upload');
form.fileupload({
url: form.attr('action'),
type: 'POST',
// autoUpload: true,
dataType: 'xml', // This is really important as s3 gives us back the url of the file in a XML document
process: [
public function profile_save( $user_id ) {
$fields = self::$setup['theme']['profile']['fields'];
if ( !current_user_can( 'edit_user', $user_id ) ) return false;
foreach ($fields as $field => $attr) {
if ( isset($_POST[$field]) || isset($_FILES[$field]) ) {
$value = $_POST[$field];
if ( $value ) update_user_meta( $user_id, $field, $value );
}
}
}
function function_name($user_id) {
if( isset($_POST['company_name']) ) update_user_meta( $user_id, 'company_name', $_POST['company_name'] );
}
add_action( 'user_register', 'function_name');