Skip to content

Instantly share code, notes, and snippets.

@brettshumaker
brettshumaker / star-rating.js
Last active December 8, 2016 02:27
Generate Star Rating with Dashicons
/**
* See this on CodePen.io - http://codepen.io/brettshumaker/pen/NbzGjR
*/
jQuery(document).ready(function($) {
// Rating starts as a value out of 100 - 87/100
// You may need to adjust this depending on your data source
var myRating = 87;
// This is just generic code to place the rating HTML into a container
This file has been truncated, but you can view the full file.
;FLAVOR:RepRap
;TIME:4609
;Generated with Cura_SteamEngine 2.3.1
M190 S60
M104 S195
M109 S195
G21 ;metric values
G90 ;absolute positioning
M82 ;set extruder to absolute mode
M107 ;start with the fan off
@brettshumaker
brettshumaker / attachment-modal.php
Created January 27, 2017 18:44
Altered file for svg-support/functions/attachment-modal.php Fatal Error
<?php
/**
* Display SVG in attachment modal
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
function bodhi_svgs_response_for_svg( $response, $attachment, $meta ) {
@brettshumaker
brettshumaker / Staff-Loop-Template.html
Created March 7, 2017 03:30
Simple Staff List change Twitter link
<!--
This is just an example staff loop
To use the custom template tag in functions.php just
copy/paste line 14 below into your own Staff Loop Template
-->
[staff_loop]
<img class="staff-member-photo" src="[staff-photo-url]" alt="[staff-name] : [staff-position]">
<div class="staff-member-info-wrap">
[staff-name-formatted]
[staff-position-formatted]
@brettshumaker
brettshumaker / hooks-n-filters.php
Created May 31, 2017 20:08
Fatal Error on line 1033 hooks-n-filters.php
<?php
add_action( 'woocommerce_subscriptions_updated_users_role', 'st_woocommerce_subscriptions_updated_users_role', 11, 3 );
function st_woocommerce_subscriptions_updated_users_role( $role_new, $user, $role_old ) {
$_pf = new WC_Product_Factory();
if ( 'member_going_in' == $role_new || WC_Subscriptions_Manager::user_has_subscription( $user->ID, '', 'active') ) {
$subscriptions = wcs_get_users_subscriptions($user->ID);
@brettshumaker
brettshumaker / class-wc-shipstation-api-export.php
Last active November 22, 2021 04:47
Add `woocommerce_shipstation_export_custom_order_xml_data` filter to allow extra data to be sent to ShipStation
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* WC_Shipstation_API_Export Class
*/
class WC_Shipstation_API_Export extends WC_Shipstation_API_Request {
@brettshumaker
brettshumaker / format.php
Created January 9, 2018 20:56
Adding an "Address" format to FormidablePro2PDF
// Add this to the switch( $format ) statement in fpropdf_format_field() /format.php ~line 429
case 'address':
$v = maybe_unserialize( $v );
if ( ! is_array( $v ) )
break;
$address = '';
foreach ( $v as $key => $this_value ) {
@brettshumaker
brettshumaker / sslp-post-nominal-field.php
Created April 6, 2018 19:50
Simple Staff List Add Custom Field Example - does not add to [simple-staff-list] output, just creates a metabox and saves the data.
<?php
/**
* Plugin Name: Simple Staff List - Post Nominal Field
* Description: Adds a "Post Nominal" field for Simple Staff List plugin
* Version: 1.0
* Author: Brett Shumaker
* Author URI: https://brettshumaker.com
* License: GPL2
**/
@brettshumaker
brettshumaker / fix-wp-link-query.php
Last active October 31, 2018 20:38
Fix `wp_link_query` special character encoding
@brettshumaker
brettshumaker / wp-query-object.php
Last active February 8, 2019 12:28
$wp_query object
<?php
WP_Query::__set_state(
array(
'query' => array(),
'query_vars' => array(
'error' => '',
'm' => '',
'p' => 0,
'post_parent' => '',