Skip to content

Instantly share code, notes, and snippets.

View garretthyder's full-sized avatar
🗞️
Working away

Garrett Hyder garretthyder

🗞️
Working away
View GitHub Profile
@boonebgorges
boonebgorges / gist:2401529
Created April 16, 2012 21:09
Add an "Other" option at the end of a list of BuddyPress profile checkbox options, where users can enter custom text
<?php
/**
* Add an 'Other' type to xprofile fields
*
* @link https://buddypress.trac.wordpress.org/ticket/3775
* @link http://redmine.gc.cuny.edu/issues/1199
*/
class CAC_Xprofile_Other {
function __construct() {
add_action( 'xprofile_field_additional_options', array( &$this, 'render_admin' ) );
@ChromeOrange
ChromeOrange / functions.php
Created July 29, 2012 22:32
Replace all add to cart button text
<?php
// Single Product
add_filter( 'single_add_to_cart_text', 'custom_single_add_to_cart_text' );
function custom_single_add_to_cart_text() {
return 'Add to cart'; // Change this to change the text on the Single Product Add to cart button.
}
// Variable Product
add_filter( 'variable_add_to_cart_text', 'custom_variable_add_to_cart_text' );
@Chrisedmo
Chrisedmo / latest-blog-posts.css
Created July 31, 2012 11:29
Shopify: Latest Blog Posts
.widget .latest-blog-posts-list {
margin: 0;
list-style: none;
}
.widget .latest-blog-posts-list li {
margin: 0 0 10px 0;
padding: 0 0 10px 0;
border-bottom: dotted 1px #CCC;
background: none;
word-wrap: break-word;
@zachharkey
zachharkey / .bashrc
Created May 22, 2013 22:02
Cpanel .bashrc to prevent error: "stdin: is not a tty"
# .bashrc
# Prevent "stdin: is not a tty" errors
if [ $(expr index "$-" i) -eq 0 ]; then
return
fi
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
@jaredatch
jaredatch / gist:5645033
Last active February 4, 2023 12:51
Modify/change the default allowed tags for bbPress.
<?php
/**
* Modify/change the default allowed tags for bbPress.
*
* The default list (below) is in bbpress/includes/common/formatting.php, L24-66.
* Adjust below as needed. This should go in your theme's functions.php file (or equivilant).
*/
function ja_filter_bbpress_allowed_tags() {
return array(
@daithi-coombes
daithi-coombes / functions.php
Last active September 8, 2018 13:37
To enable 'price from' and 'price to' search for wordpress [WP Property Plugin](https://usabilitydynamics.com/products/wp-property/forum/topic/price-range-search/)
/**
* Rename these to the form input names you are going to use.
* When you create a new attribute in Properties->Settings->Developer
* the form input name will appear greyed out under the attribute name
*/
define('SPRP_SEARCH_FROM_KEY', 'price_from_per_month');
define('SPRP_SEARCH_TO_KEY', 'price_to_per_month');
function parse_search(){
@yratof
yratof / functions.php
Created March 10, 2015 14:37
ACF OEmbed with thumbnails
<?php
/* Pull apart OEmbed video link to get thumbnails out*/
function get_video_thumbnail_uri( $video_uri ) {
$thumbnail_uri = '';
// determine the type of video and the video id
$video = parse_video_uri( $video_uri );
// get youtube thumbnail
@garretthyder
garretthyder / woocommerce_emails_attach_downloadables.php
Created August 13, 2015 11:45
Add Downloadable Products to Woocommerce Completed Order & Invoice Emails as Attachments
<?php
// Add Downloadable Products to Woocommerce Completed Order & Invoice Emails as Attachments
function woocommerce_emails_attach_downloadables($attachments, $status, $order) {
if ( ! is_object( $order ) || ! isset( $status ) ) {
return $attachments;
}
if ( empty( $order ) ) {
return $attachments;
@mikejolley
mikejolley / ipn-test.php
Last active September 18, 2020 14:29
Quick snippet/plugin/dropin to test IPN support
<?php
/**
* Plugin Name: PayPal Sandbox IPN Tester
* Description: Pings the IPN endpoint to see if your server can connect. Just head to <a href="/?ipn-test=1">yoursite.com/?ipn-test=1</a> whilst logged in as admin.
* Version: 1.0.0
* Author: WooThemes
* Requires at least: 4.1
* Tested up to: 4.3
*/
if ( ! defined( 'ABSPATH' ) ) {
@davidroyer
davidroyer / shortcodes.php
Created February 3, 2016 20:37 — forked from gyrus/shortcodes.php
TinyMCE button for WordPress shortcode
<?php
/**
* Skeletal sample shortcode
*/
add_shortcode( 'pilau-sample', 'pilau_sample_shortcode' );
function pilau_sample_shortcode( $atts ) {
extract( shortcode_atts( array(
'text' => ''
), $atts ) );