Skip to content

Instantly share code, notes, and snippets.

View peterhartree's full-sized avatar

Peter Hartree peterhartree

View GitHub Profile
/**
* @extends \WC_Email
*/
class WC_Custom_Order_Email extends WC_Email {
/**
* Set email defaults
*/
public function __construct() {
@peterhartree
peterhartree / wp-capitalise-term-title.php
Created August 10, 2014 14:24
WordPress: Capitalise term title
/**
* Capitalises the first letter of term title for display.
*/
function capitalise_term_titles( $term_obj ) {
$term_obj->name = ucfirst($term_obj->name);
return $term_obj;
}
add_filter( 'get_term', 'capitalise_term_titles' );
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@peterhartree
peterhartree / _header.less
Last active August 29, 2015 14:09
Compensate for the Bootstrap fixed top navigation bar, and offset if WordPress admin bar is visible.
// Compensate for the Bootstrap fixed top navigation bar.
//
// No styleguide reference.
body {
padding-top: @navbar-height;
}
// Offset fixed top navigation bar if WordPress admin bar is
// visible.
@peterhartree
peterhartree / textstroke.js
Created June 10, 2013 13:12
Text-stroke feature detect for use with Modernizr.js
/*!
{
"name": "CSS text-stroke",
"property": "text-stroke",
"caniuse": "css-text-stroke",
"tags": ["css"],
"knownBugs": ["None"]
}
!*/
h1,h2,h3,h4,h5,h6,em,.sok_font{font-family:"switchedonkidsnormal",Arial;text-transform:none;letter-spacing:0px;font-weight:normal;line-height:1.2;color:#fff; -webkit-text-fill-color:#fff;-webkit-text-stroke:1px #000;text-fill-color:#fff;text-stroke:1px #000}
@peterhartree
peterhartree / wordpress-headlines.php
Last active December 28, 2015 12:29
How to use the SimplePie RSS library to display a list of linked article headlines from a Wordpress RSS feed on a non-Wordpress PHP page.
<?php
/** Outputs a list of linked article headlines from a Wordpress recent posts RSS feed. */
$simplepie_path = "includes/simplepie/"; // path to SimplePie RSS library
$feed_url = 'http://yourblog.com/feed/'; // url of your blog's RSS feed
$cache_location = $_SERVER['DOCUMENT_ROOT'] . '/includes/simplepie-cache'; // set cache directory (make sure that the directory exists and that this script can write to it)
$max_items = 3; // max feed items to show
$first_item = 0; // feed item to start from
require_once($simplepie_path.'autoloader.php');
@peterhartree
peterhartree / beemind-me-in-the-morning.sh
Created January 30, 2016 20:31
Create a new Beeminder datapoint if current system time is within a given window.
# Create a new Beeminder datapoint if current system time is within a
# given window.
#
# Possible use case: if you're on OS X, you can trigger this script with
# the free ControlPlane app. This means you can automatically Beemind
# yourself to a given location before a given time.
#
# Originally made by @peterhartree in order to Beemind his way to the
# office bright and early. Check up on him at
# https://www.beeminder.com/peterhartree/goals/rcu :P
@peterhartree
peterhartree / messages.json
Created December 18, 2016 11:42
Inbox When Ready German l18n
{
"appName": {
"message": "Inbox When Ready für Gmail™",
"description": "The name of the application, displayed in the web store."
},
"appDesc": {
"message": "Schützen Sie Ihren Fokus... verstecken Sie Ihre Google Mail-Posteingang.",
"description": "The short description of the application, displayed in the web store."
},
"hideInbox": {
@peterhartree
peterhartree / messages.json
Created April 14, 2017 11:26
Inbox When Ready l18n
{
"appName": {
"message": "Inbox When Ready for Gmail™",
"description": "The name of the application, displayed in the web store."
},
"appDesc": {
"message": "Protect your focus... improve your inbox workflow.",
"description": "The short description of the application, displayed in the web store."
},
"hideInbox": {