Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / post.php
Last active August 29, 2015 14:01
wp_edit_posts_query function from wp-admin/includes/post.php line 849
<?php
/**
* Run the wp query to fetch the posts for listing on the edit posts page
*
* @since 2.5.0
*
* @param array|bool $q Array of query variables to use to build the query or false to use $_GET superglobal.
* @return array
*/
@solepixel
solepixel / class-wc-gateway-authorize-net.php
Last active August 29, 2015 14:01
woocommerce authorize.net payment gateway bug found in woocommerce-gateway-authorize-net-aim/classes
<?php
function process_payment( $order_id ) {
global $woocommerce;
$order = new WC_Order( $order_id );
// the meta for order_tax isn't available yet because of meta caching in wordpress, pull tax from cart tax_total
$order_tax = $order->order_tax ? $order->order_tax : WC()->cart->tax_total;
$testmode = ($this->testmode == 'yes') ? 'TRUE' : 'FALSE';
@solepixel
solepixel / my-virtual-merchant-submit.php
Created June 13, 2014 21:28
My Virtual Merchant Submission Button
<?php
/**
* My Virtual Merchant Submission Button
* Description: This button will allow users to send customers and clients to the My Virtual Merchant payment form
* Version: 1.0.0
* Author: Brian DiChiara
* Author URI: http://www.briandichiara.com
*/
$post_url = 'https://www.myvirtualmerchant.com/VirtualMerchant/process.do';
<?php get_header(); ?>
<div id="content" class="clearfix row">
<div id="main" class="col-sm-8 clearfix" role="main">
<div class="page-header">
<?php if (is_category()) { ?>
<h1 class="archive_title h2">
<span><?php _e("Posts Categorized:", "wpbootstrap"); ?></span> <?php single_cat_title(); ?>
@solepixel
solepixel / fade-label.jquery.js
Created September 18, 2014 19:33
Fade Labels for jQuery
/**
* Fade Labels
*
* @version 1.0.0
* @author Brian DiChiara
* @website http://briandichiara.com
*/
(function ( $ ) {
$.fn.fadeLabel = function( options ){
@solepixel
solepixel / acf-reusable_field_group-v5.php
Created October 28, 2014 14:17
render_field() method in ACF-Reusable-Field-Group extension for Advanced Custom Fields/Pro Plugin
<?php
// ...
// @ line 137
# see https://github.com/tybruffy/ACF-Reusable-Field-Group/blob/master/acf-reusable_field_group-v5.php#L137
function render_field( $field ) {
global $post;
$current_id = $post->ID; ### $post is not defined/availabe on a Settings page
// Load plugins
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
cache = require('gulp-cache'),
compass = require('gulp-compass'),
concat = require('gulp-concat'),
imagemin = require('gulp-imagemin'),
jshint = require('gulp-jshint'),
imagemin = require('gulp-imagemin'),
livereload = require('gulp-livereload'),
@solepixel
solepixel / really-sticky-posts.php
Last active August 29, 2015 14:23
This little snippet will consistently place sticky posts at the top of ALL post archive pages, not just the first page.
<?php
add_filter( 'the_posts', 'mytheme_inject_sticky_posts', 10, 2 );
function mytheme_inject_sticky_posts( $posts, $q ){
// Don't do this in the admin or on page 1, WP already does it for page 1
if( is_admin() || $q->get( 'paged' ) <= 1 )
return $posts;
// get the sticky posts array