Skip to content

Instantly share code, notes, and snippets.

View thefrosty's full-sized avatar
🏖️
Santa Monica WordPress Developer

Austin Passy thefrosty

🏖️
Santa Monica WordPress Developer
View GitHub Profile
// 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();
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 );
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',
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 August 22, 2011 20:12
Looking for select 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 September 30, 2011 16:42
Getting foreach error on empty posts..
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() )
@thefrosty
thefrosty / ajax_sms
Created October 4, 2011 22:58
ajax response
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 October 14, 2011 23:38
do_shortcode() in an AJAX call
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 October 21, 2011 20:08
MySQL create error
$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 December 14, 2011 01:03
Core functionality plugin.
<?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