This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$properties = array('name','slug','id'); | |
foreach ($properties as $prop) { | |
if (!isset($atts[$prop])) continue; | |
$Product = new Product($atts[ $prop ],$prop); | |
} | |
if ( ! empty($Product->id) ) { | |
ShoppProduct($Product); | |
} elseif ( ! isset( ShoppProduct->id() ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('wp_ajax_cart_modal_update', 'update_cart_modal'); | |
add_action('wp_ajax_nopriv_cart_modal_update', 'update_cart_modal'); | |
function update_cart_modal() { | |
parse_str($_REQUEST['form_fields'], $_REQUEST); | |
if (!empty($_REQUEST['items'])) { | |
foreach ($_REQUEST['items'] as $id => $item) { | |
if (array_key_exists('quantity', $item) && is_numeric($item['quantity'])) { | |
$item['quantity'] = absint($item['quantity']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sort_terms ( $terms ) { | |
$sort_terms = array(); | |
foreach($terms as $term) { | |
$sort_terms[$term->name] = $term; | |
} | |
uksort( $sort_terms, 'strnatcmp'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('get_terms', 'sort_terms_naturally', 20, 3); | |
function sort_terms_naturally ( $terms, $taxonomies, $args ) { | |
if ( isset($args['orderby']) && $args['orderby'] == 'natural' ) { | |
$sort_terms = array(); | |
foreach($terms as $term) { | |
$sort_terms[$term->name] = $term; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('get_terms_orderby', 'reorder_categories_admin', 20, 2); | |
function reorder_categories_admin($orderby, $args) | |
{ | |
global $pagenow; | |
// If not category, bail | |
if ( ! isset($args['taxonomy']) || $args['taxonomy'] != 'category' ) return $orderby; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once './SettingsAPI.php'; | |
class MyPlugin extends SettingsAPI { | |
var $prefix = 'myplugin_'; | |
/* CRAZY AWESOME STUFF */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* WordPress Simple Settings | |
* | |
* A simple framework for managing WordPress plugin settings. | |
* | |
* @author Clifton H. Griffin II | |
* @version 0.1 | |
* @copyright Clif Griffin Development, Inc. 2013 | |
* @license GNU GPL version 3 (or later) {@see license.txt} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('wooslider_get_slides', 'shopp_wooslider', 10, 4); | |
public function shopp_wooslider($slides, $type, $args, $settings) { | |
if( is_shopp_product() ) { | |
$slides = array(); | |
if ( shopp('product', 'has-images') ) { | |
while( shopp('product','images') ) { | |
$data = array( 'content' => shopp('product','get-image',"setting={$args['size']}") ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function start_pulse(element) { | |
jQuery(element).removeClass("stopped"); | |
jQuery(element).fadeIn(500, function() { | |
jQuery(this).fadeOut(500, function() { | |
if ( !jQuery(this).hasClass("stopped") ) { | |
start_pulse(); | |
} else { | |
jQuery(this).fadeIn(500); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('wp_ajax_impersonate_customer', 'mg_impersonate_customer'); | |
function mg_impersonate_customer() { | |
get_currentuserinfo(); | |
$Order = ShoppOrder(); | |
$Order->data['Agent'] = $current_user->user_login; | |
$Order->data['CustomerUserID'] = $customer->wpuser; |