Skip to content

Instantly share code, notes, and snippets.

View thadallender's full-sized avatar

Thad Allender thadallender

View GitHub Profile
<?php
/**
* Remove the default Sell Media action.
* We'll replace it with our own custom action hook below.
*/
remove_action( 'sell_media_before_content', 'sell_media_append_media' );
/**
* Add our new action hook to alter the media (featured image, etc) before the_content in Sell Media
@thadallender
thadallender / sell-media-prints-filter.php
Created July 9, 2015 21:56
Filter for Sell Media "Prints" text
<?php
/**
* Filter for prints text
*/
function sell_media_print_text_filter(){
return 'books';
}
add_filter( 'sell_media_print_text', 'sell_media_print_text_filter' );
@thadallender
thadallender / sell-media-image-size-filter.php
Created August 14, 2015 13:12
Filter to Sell Media that adds a new image size for a new image aspect ratio used in Sell Media archives and shortcodes
<?php
/**
* Plugin Name: Sell Media Image Size Filter
* Plugin URI: https://graphpaperpress.com/plugins/sell-media/
* Description: Filter to Sell Media that adds a new image size for a new image aspect ratio used in Sell Media archives and shortcodes
* Version: 1.0.0
* Author: Thad Allender
* Author URI: https://graphpaperpress.com
* Author Email: support@graphpaperpress.com
* Text Domain: sell_media
@thadallender
thadallender / jquery-vanishing-message-scroll.js
Last active November 11, 2015 16:45
Vanishing welcome message on scroll. Tutorial here: https://graphpaperpress.com/?p=74953
jQuery( document ).ready( function( $ ) {
// This is where we apply opacity to the intro overlay
$( window ).scroll( function() {
// Hide the overlay if user has scrolled past 1px from top
if ( $( window ).scrollTop() >= 1 ) {
$( '.vanishing-message' ).removeClass('has-overlay');
$( '.vanishing-message .text' ).css( 'opacity', 0 );
}
<div class="vanishing-message">
<img src="https://images.graphpaperpress.com.s3.amazonaws.com/sky-2400x1200.jpeg" />
<div class="text">
<span class="prelude">Commercial / Editorial / Advertising</span>
<span class="desc">Photography by Grant Smith</span>
</div>
</div>
@thadallender
thadallender / vanishing-message.css
Created November 11, 2015 16:42
Vanishing welcome message
.vanishing-message {
position: relative;
}
.vanishing-message img {
width: 100%;
height: auto;
display: block;
}
@thadallender
thadallender / allow-my-custom-host.php
Created December 3, 2015 19:02
Filter for allowing local theme and plugin repo updates (for testing, never us on production site)
<?php
/** Enable my local themes and plugins repository FFS!!! */
function allow_my_custom_host( $allow, $host, $url ) {
if ( $host == 'put-your-repository-domain-here.com' )
$allow = true;
return $allow;
}
add_filter( 'http_request_host_is_external', 'allow_my_custom_host', 10, 3 );
@thadallender
thadallender / sell-media-custom-text-filters.php
Created February 14, 2016 16:13
Changes Sell Media's terms of service label on Checkout page.
<?php
/**
* Add the following function to your own functionality plugin
* or add it to your theme's functions.php file.
* Change any of the text inside the return value.
*/
function my_sell_media_tos_label() {
return 'Hey this is my custom text. Please agree to our <a href="javascript:void(0);" class="sell-media-empty-dialog-trigger">terms of service</a>.';
}
@thadallender
thadallender / sell-media-custom-item-shortcode.php
Last active March 1, 2016 00:24
Remove default Sell Media shortcode [sell_media_item] and replace with a custom version
<?php
/**
* Plugin Name: My Sell Media Shortcode
* Plugin URI: http://graphpaperpress.com/plugins/sell-media/
* Description: An example shortcode plugin for Sell Media.
* Version: 1.0
* Author: Graph Paper Press
* Author URI: http://graphpaperpress.com
* Author Email: support@graphpaperpress.com
* Text Domain: sell_media
@thadallender
thadallender / sell-media-manual-purchase-filter-text.php
Created August 1, 2016 20:14
Sell Media - Filter "Manual Purchase" text
<?php
/**
* Filter the "Manual Purchase" text shown on the Checkout page
*/
function sell_media_manual_purchases_filter_text(){
return 'Cash/Check';
}
add_filter( 'sell_media_manual_purchases_text', 'sell_media_manual_purchases_filter_text' );