Skip to content

Instantly share code, notes, and snippets.

View pippinsplugins's full-sized avatar

Pippin Williamson pippinsplugins

View GitHub Profile
<?php
function edd_change_downloads_upload_dir() {
global $pagenow;
if ( ! empty( $_POST['post_id'] ) && ( 'async-upload.php' == $pagenow || 'media-upload.php' == $pagenow ) ) {
if ( 'download' == get_post_type( $_REQUEST['post_id'] ) ) {
$wp_upload_dir = wp_upload_dir();
$upload_path = $wp_upload_dir['basedir'] . '/edd' . $wp_upload_dir['subdir'];
if (wp_mkdir_p($upload_path) && !file_exists($upload_path.'/.htaccess')) {
@pippinsplugins
pippinsplugins / paypal-standard.php
Created May 31, 2012 15:31
New PayPal Standard for EDD
<?php
/**
* PayPal Standard Gateway
*
* @package Easy Digital Downloads
* @subpackage PayPal Standard Gateway
* @copyright Copyright (c) 2012, Pippin Williamson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 1.0
*/
@pippinsplugins
pippinsplugins / edd_labels.php
Created June 15, 2012 02:03
Change EDD Download Labels Globally
<?php
function pw_edd_global_labels($labels) {
$labels = array(
'singular' => __('Singular Label','edd'),
'plural' => __('Plural Label','edd')
);
return $labels;
}
add_filter('edd_default_downloads_name', 'pw_edd_global_labels');
@pippinsplugins
pippinsplugins / edd_discount_label.php
Created June 15, 2012 02:16
Change the Discount Code label in Easy Digital Downloads
<?php
function pw_edd_discount_label( $translated_text, $text, $domain ) {
switch( $translated_text ) {
case 'Enter discount':
$translated_text = 'Enter Discount Code Here';
break;
}
@pippinsplugins
pippinsplugins / edd_statuses.php
Created July 5, 2012 22:30
Register Custom EDD payment Statuses
<?php
function pippin_edd_extra_statuses( $statuses ) {
$statues['your_status_id'] => 'Your Status Label';
$statues['your_second_status_id'] => 'Your Second Status Label';
return $statuses
}
add_filter('edd_payment_statuses', 'pippin_edd_extra_statuses');
@pippinsplugins
pippinsplugins / wrapper.php
Created July 17, 2012 00:02 — forked from anointed/finished.php
Filter to apply a div before menu output
<?php
function tumble_menu( $args = array() ) {
/* Default arguments */
$defaults = array(
'container' => 'ul',
'menu_class' => 'nav',
'menu_id' => 'top_nav',
'theme_location' => 'top-menu',
'echo' => false,
'before' => '',
@pippinsplugins
pippinsplugins / edd_emails.php
Created July 19, 2012 12:56
Remove list indention
<?php
function edd_remove_list_indention( $email_body ) {
$email_body = str_replace('<ul>', '<ul style="margin:0 0 10px;padding:0;">', $email_body);
$email_body = str_replace('<li>', '<li style="margin:0 0 8px;padding:0;">', $email_body);
return $email_body;
}
add_filter('edd_purchase_receipt_default', 'edd_remove_list_indention');
<?php
function ecpt_include_post_types_in_search($query) {
if( $query->is_main_query() && is_search() && $query->query_vars['post_type'] != 'nav_menu_item' ) {
$post_types = get_post_types(array('exclude_from_search' => false), 'objects');
$searchable_types = array();
if($post_types) {
foreach( $post_types as $type) {
$searchable_types[] = $type->name;
}
/**
* Retrieve current sidebar ID for a location.
*
* @since 2.0.0
*
* @param string $location the location for the sidebar
* @return string $id the id of the sidebar that should be shown
*/
if( ! function_exists( 'themeblvd_get_sidebar_id' ) ) {
function pw_change_archive_order( $query ) {
if( $query->is_main_query() && is_archive() ) {
$query->set('order', 'ASC');
}
}
add_action('pre_get_posts', 'pw_change_archive_order');