Skip to content

Instantly share code, notes, and snippets.

@solepixel
solepixel / helpers.php
Created March 11, 2014 22:25
Helpers file in MIni Loops Plugin
<?php
# ...
function miniloops_shortcoder( $input ) {
$input = wp_filter_post_kses( $input );
//give our shortcodes the correct prefix
$input = str_replace( '[', '[ml_', $input );
$input = str_replace( '[/', '[/ml_', $input );
//make sure we haven't doubled-up
@solepixel
solepixel / company.php
Created February 17, 2014 05:44
iThemes Exchange attempts to create a custom customer/registration field.
<?php do_action( 'it_exchange_content_registration_before_company_element' ); ?>
<div class="it-exchange-registration-company">
<?php it_exchange( 'dichiara_registration', 'company' ); ?>
</div>
<?php do_action( 'it_exchange_content_registration_after_company_element' ); ?>
@solepixel
solepixel / st2-setup.txt
Last active December 26, 2015 18:49
sublime text 2 setup
Sublime Text 2 Setup:
Packages:
1. Package Control: https://sublime.wbond.net/installation - This will allow you easily install other packages
2. DocBlockr
3. Gist (You'll need to setup the config for this to work)
4. Goto Documentation (Customize this for super+click)
5. LiveReload
6. Prefixr
7. Sass
@solepixel
solepixel / dynamic-pricing-table.php
Last active April 20, 2018 19:11
dynamic pricing table
<?php
function display_dynamic_pricing_table(){
global $post;
# see line 42 of woocommerce_pricing_by_product.class.php
$pricing_rule_sets = get_option('_a_category_pricing_rules', array());
$found = false;
if(count($pricing_rule_sets)){
global $woocommerce_pricing;
foreach ($pricing_rule_sets as $pricing_rule_set) {
<?php
if( function_exists('cgc_ub_show_user_badges') ) {
$member = cgc_get_user_data();
cgc_ub_show_user_badges( $member->ID );
}
@solepixel
solepixel / notices.php
Last active December 25, 2015 15:49
Sample Usage of cgc_notices
<?php
function handle_notices(){
$updated = isset( $_GET['whatever-updated'] ) ? $_GET['whatever-updated'] : false;
if( $updated !== false ){
$type = $updated ? 'success' : 'error';
$message = $updated ? __( 'Your whatever was updated.', 'cgc' ) : __( 'There was a problem updating whatever.', 'cgc' );
cgc_add_notice( $message, $type );
}
}
add_action( 'cgc_notices', 'handle_notices' );
@solepixel
solepixel / image-widget.php
Created August 25, 2013 14:48
Suggested change for Tri.be Image Widget plugin, image-widget/image-widget.php, See line 32 and 84 for changes.
<?php
class Tribe_Image_Widget extends WP_Widget {
// ...
private function get_image_html( $instance, $include_link = true ) {
// Backwards compatible image display.
if ( $instance['attachment_id'] == 0 && $instance['image'] > 0 ) {
@solepixel
solepixel / stacked-date.php
Last active December 19, 2015 00:49
Stacked Date
$prefix = hybrid_get_prefix();
add_filter( "{$prefix}_byline", 'wwon_byline');
function wwon_byline($byline){
if(!is_single()){
$byline = '<div class="post-date">
<span class="post-date-month">'.get_the_date('M').'</span>
<span class="post-date-day">'.get_the_date('d').'</span>
</div>
@solepixel
solepixel / index.html
Created June 3, 2013 20:53
Temporary index.html file for site launching.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html" />
<meta name="author" content="Brian DiChiara" />
<title>Launching...</title>
<style type="text/css">
* { margin:0; padding:0; }
body, html, .container { background:#2f2f2f; }
p { margin:100px auto; text-align:center; font-size:0; width:373px; height:29px; background:url(http://assets.infomedia.net/launching.gif) no-repeat 50% 50%; }
@solepixel
solepixel / delete-them-all.php
Last active December 17, 2015 23:19
Delete Them All Plugin for WordPress
<?php
/**
* Plugin Name: Delete Them All!
* Plugin URI: http://infomedia.com
* Description: Delete ALL posts and associated data, leaving your database nice and clean!
* Version: 1.0
* Author: Brian DiChiara
* Author URI: http://www.briandichiara.com
*/