Skip to content

Instantly share code, notes, and snippets.

Avatar

Devin Price devinsays

View GitHub Profile
@devinsays
devinsays / custom_edd_sl_license_response
Last active August 29, 2015 14:02
Allow "Package" downloads. Multiple file downloads using the same license.
View custom_edd_sl_license_response
/**
* This code requires one additional filter param to be added to edd_sl_license_response in EDD_Software_Licensing.php:
* $response = apply_filters( 'edd_sl_license_response', $params, $download, $data)
*/
/**
* Allows EDD to bypass the name check for files
*/
define( 'EDD_BYPASS_NAME_CHECK', true );
@devinsays
devinsays / edd-csv-purchase-import.php
Created June 13, 2014 19:31
CSV Purchase Import for EDD
View edd-csv-purchase-import.php
<?php
/*
Plugin Name: Easy Digital Downloads - CSV Purchase Import
Plugin URL: http://easydigitaldownloads.com/extension/csv-purchase-import
Description: Allows you to import purchase history CSVs from other ecommerce systems
Version: 0.1
Author: Pippin Williamson
Author URI: http://pippinsplugins.com
Contributors: mordauk
*/
@devinsays
devinsays / font_page_directory_query
Last active August 29, 2015 14:08
This displays a "directory" post type on the home page, sorted by the meta_key "last_name" in alphabetical order
View font_page_directory_query
<?php
/**
* Load 'directory' post type archive on home page
* Orderby the meta_key 'last_name' ASC
*
* Reference: http://wptheming.com/2014/10/displaying-a-custom-post-type-archive-on-the-front-page/
*/
function prefix_directory_front_page( $query ) {
// Only filter the main query on the front-end
View cascade-comment-pagination
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through ?>
<nav id="comment-nav-above" class="pagination comment-pagination" role="navigation">
<h1 class="screen-reader-text"><?php _e( 'Comment navigation', 'cascade' ); ?></h1>
<span class="page-numbers"><?php printf( __( 'Page %1$s of %2$s', 'cascade' ), ( get_query_var( 'cpage' ) ? absint( get_query_var( 'cpage' ) ) : 1 ), get_comment_pages_count() ); ?></span>
<?php paginate_comments_links(); ?>
</nav><!-- .comment-navigation -->
<?php endif; // check for comment navigation ?>
@devinsays
devinsays / photon-experiments.php
Created January 21, 2015 22:53
Photon Experiments - Image Quality
View photon-experiments.php
<?php
/**
* Plugin Name: Photon Experiments
* Description: Experimenting with Photon parameters.
* Version: 0.1.0
*/
if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) :
function photon_experiments() {
@devinsays
devinsays / featured-image-meta
Last active August 29, 2015 14:15
Display Featured Image Meta
View featured-image-meta
@devinsays
devinsays / ae-1-app.js
Created March 13, 2015 16:26
ae-1-app.js
View ae-1-app.js
var myapp = angular.module( 'myapp', [] );
// Set the configuration
myapp.run( ['$rootScope', function($rootScope) {
// Variables defined by wp_localize_script
$rootScope.api = aeJS.api;
}]);
@devinsays
devinsays / ae-1-functions.php
Created March 13, 2015 16:20
ae-1-functions.php
View ae-1-functions.php
<?php
/**
* Angular Experiments.
* Enqueue scripts and styles for the front end.
*
* @since 1.0.0
*/
function ae_scripts() {
// Load main stylesheet.
wp_enqueue_style( 'ae-style', get_stylesheet_uri() );
@devinsays
devinsays / ae-1-index.php
Created March 13, 2015 16:32
ae-1-index.php
View ae-1-index.php
<div ng-controller="mycontroller">
<article ng-repeat="post in posts">
<h3>{{ post.title }}</h3>
<p>{{ post.excerpt }}</p>
</article>
</div>
View upsell-enqueue
<?php
/**
* Display upgrade notice on customizer page
*/
function prefix_upsell_notice() {
// Enqueue the script
wp_enqueue_script(
'prefix-customizer-upsell',
get_template_directory_uri() . '/js/upsell.js',