Skip to content

Instantly share code, notes, and snippets.

@solepixel
solepixel / .htaccess
Last active February 13, 2024 15:00
This htaccess snippet (lines 4-12) will pull any missing images from another URL. Helpful when developing locally or on a staging site where media is present on production but is too much to migrate to staging or locally.
<IfModule mod_rewrite.c>
RewriteEngine On
# BEGIN Use uploads directory from Live Site
RewriteBase /wp-content/uploads/
RewriteCond %{HTTP_HOST} !^www\.livedomain\.com
RewriteCond %{HTTP_HOST} !^livedomain\.com
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
@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
// 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 / im-bruce-willis.lyrics.txt
Last active May 14, 2018 14:14
I'm Bruce Willis by Wreck&Salvage (https://vimeo.com/13033974)
Yeah
Yo, why you tryin' to hurt me girl
Don'tcha know I'm Bruce Willis.
Yeah
Yo, why you tryin' to hurt me girl
Don'tcha know I'm Bruce, Bruce
@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
@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 ){
<?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 / 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';
@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 / 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
*/