Skip to content

Instantly share code, notes, and snippets.

Avatar
🏖️
Santa Monica WordPress Developer

Austin Passy thefrosty

🏖️
Santa Monica WordPress Developer
View GitHub Profile
View jQuery Tabs
// Setting the tabs in the sidebar hide and show, setting the current tab
jQuery('.tab-content').hide();
jQuery('.t1').show();
jQuery('ul.tabs li.t1 a').addClass('tab-current');
jQuery('ul li a').css('cursor','pointer');
jQuery('#tab ul.tabs li.t1 a').click(
function() {
jQuery('#tab div.tab-content').hide();
View Filter EXIF in WordPress
function add_orientation_exif( $meta, $file, $sourceImageType ) {
$exif = @exif_read_data( $file, 'IFD0' );
if ( !empty( $exif['IFD0']['Orientation'] ) )
$meta['IFD0']['orientation'] = $exif['IFD0']['Orientation'];
return $meta;
}
add_filter( 'wp_read_image_metadata', 'add_orientation_exif', '', 3 );
View Check for multiple WordPress attachments
If there is more than one attachment, add a second shortcode parameter:
<?php
if ( in_category( 'photo' ) ) {
do_shortcode( '[gallery numberposts="1" columns="1" link="attachment"]' );
//http://wordpress.org/support/topic/if-postpage-has-more-than-one-attachment
$args = array(
'post_type' => 'attachment',
View jQuery count
I'm going to set an option in the settings page to opt into this. So if users wanted to tweet from the admin a longer script, like tweet-longer then can.
@thefrosty
thefrosty / cmb array
Created Aug 22, 2011
Looking for select array
View cmb array
$product = new Cart66Product();
$setting = new Cart66Setting();
$products = $product->getModels( 'where id>0', 'order by name' );
if ( !empty( $products ) ) {
foreach( $products as $p )
$select_product = array('name' => $p->name, 'value' => $p->itemNumber);
}
$meta_boxes[] = array(
@thefrosty
thefrosty / custom columns
Created Sep 30, 2011
Getting foreach error on empty posts..
View custom columns
function columns( $columns, $post_type = 'post' ) {
$post_type = get_post_type();
if ( !post_type_supports( $post_type, 'thumbnail' ) )
return;
if ( !$columns )
return;
if ( !WP_List_Table::has_items() )
View ajax_sms
function send2() {
/* Verify the nonce */
//check_ajax_referer( 'sms-nonce' );
/* Get post data */
if ( !isset( $_POST['ajax_form_data'] ) ) die("-1");
parse_str( $_POST['ajax_form_data'], $form_data );
/* Get the form fields */
$to = sanitize_text_field( $form_data['smsTo'] );
@thefrosty
thefrosty / do_shortcode AJAX
Created Oct 14, 2011
do_shortcode() in an AJAX call
View do_shortcode AJAX
function add_twitter_discount() {
global $post;
$post_id = $_POST['id'];
$item = get_post_meta( $post_id, 'item_number_discount', true );
$numb = str_replace( 'theme-', '', $item );
//if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'confirmed' ) {
$arr = array();
@thefrosty
thefrosty / gist:1304823
Created Oct 21, 2011
MySQL create error
View gist:1304823
$sql = "CREATE TABLE {$wpdb->prefix}venuesmeta (
meta_id bigint(20) unsigned NOT NULL auto_increment,
venues_id bigint(20) unsigned NOT NULL default '0',
meta_key varchar(255) default NULL,
meta_value longtext,
PRIMARY KEY (meta_id),
KEY venues_id (venues_id),
KEY meta_key (meta_key)
) {$charset_collate};";
@thefrosty
thefrosty / WordCamp Vegas Plugability
Created Dec 14, 2011
Core functionality plugin.
View WordCamp Vegas Plugability
<?php
/**
* Plugin Name: PluginName
* Plugin URI: http://austinpassy.com/wordpress-plugins/
* Description: Core functionality for __________
* Version: 1.0.0
* Author: Austin Passy
* Author URI: http://austinpassy.com/
*
* @copyright 2012
You can’t perform that action at this time.