Skip to content

Instantly share code, notes, and snippets.

View SeanChDavis's full-sized avatar
👋
Reach out.

Sean Christopher Davis SeanChDavis

👋
Reach out.
View GitHub Profile
@SeanChDavis
SeanChDavis / do-not-remove.txt
Last active March 2, 2016 00:13
Child Theme Load Text Domain
function child_theme_slug_setup() {
load_child_theme_textdomain( 'parent-theme-slug', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'child_theme_slug_setup' );
@SeanChDavis
SeanChDavis / file.php
Created February 26, 2016 06:05
FES Redirect After Submission
<?php // DO NOT COPY THIS LINE
// vendor submission redirect
function sd_fes_vendor_submission_redirect( $output, $post_id, $form_id ) {
$output['redirect_to'] = 'http://google.com/';
return $output;
}
add_filter( 'fes_add_post_redirect', 'sd_fes_vendor_submission_redirect', 10, 3 );
@SeanChDavis
SeanChDavis / file.php
Created January 28, 2016 17:20
Disable WordPress Responsive Images
<?php // DO NOT COPY THIS LINE
function disable_srcset( $sources ) {
return false;
}
add_filter( 'wp_calculate_image_srcset', 'disable_srcset' );
@SeanChDavis
SeanChDavis / file.php
Created January 18, 2016 16:51
EDD no repeat line items in cart
<?php // DO NOT COPY THIS LINE
/**
* Prevents items from being added to the cart multiple times
*/
function pw_edd_prevent_duplicate_cart_items( $download_id, $options ) {
if( edd_item_in_cart( $download_id, $options ) ) {
if( edd_is_ajax_enabled() && defined( 'DOING_AJAX' ) ) {
die('1');
} else {
@SeanChDavis
SeanChDavis / vendd-product-image-cropping.php
Created January 18, 2016 16:08
Vendd filter - product image cropping
// removing hard cropping from Vendd product image
add_filter( 'vendd_crop_product_image', '__return_false' );
@SeanChDavis
SeanChDavis / file.php
Created January 15, 2016 17:44
EDD replace $0.00 with Free
<?php // DO NOT COPY THIS LINE
function jp_filter_edd_price( $formatted_price, $download_id, $price, $price_id ) {
if( ! edd_has_variable_prices( $download_id ) && 0 == $price ) {
$formatted_price = '<span class="edd_price" id="edd_price_' . $download_id . '">Free</span>';
}
return $formatted_price;
}
add_filter( 'edd_download_price_after_html', 'jp_filter_edd_price', 10, 4 );
@SeanChDavis
SeanChDavis / frontend-menu.php
Created December 29, 2015 20:37
FES convert dashboard tab to link
<?php
$task = ! empty( $_GET['task'] ) ? $_GET['task'] : 'dashboard';
$icon_css = apply_filters( "fes_vendor_dashboard_menu_icon_css", "icon-white" ); //else icon-black/dark
$menu_items = EDD_FES()->dashboard->get_vendor_dashboard_menu();
?>
<nav class="fes-vendor-menu">
<ul>
<?php
foreach ( $menu_items as $item => $values ) : $values["task"] = isset( $values["task"] ) ? $values["task"] : '';
if ( $values["task"] !== 'new-product' ) : ?>
@SeanChDavis
SeanChDavis / file.php
Created November 30, 2015 17:47
EDD Purchase Receipt Download Links Note
<?php // DO NOT COPY THIS LINE
/**
* Add download links note to purchase receipt
*/
function sd_download_note_purchase_receipt() {
?>
<p class="receipt-download-note"><strong><em>Click the link(s) below to download your purchase.</em></strong></p>
<?
}
@SeanChDavis
SeanChDavis / walletdeposit.php
Last active November 29, 2015 17:08
EDD Wallet Add New Deposit Levels
<?php // DO NOT COPY THIS LINE
function sd_wallet_desposit_levels( $levels ) {
// add new deposit levels to default list
$more_levels = array( '2000', '5000' );
return array_merge( $levels, $more_levels );
}
add_filter( 'edd_wallet_deposit_levels', 'sd_wallet_desposit_levels' );
@SeanChDavis
SeanChDavis / file.php
Created November 8, 2015 21:16
EDD Already Purchased Item(s)
<?php // DO NOT COPY THIS LINE
/**
* Prevents logged-in customers from purchasing an item twice
*/
function pw_edd_prevent_duplicate_purchase( $valid_data, $posted ) {
$cart_contents = edd_get_cart_contents();
foreach( $cart_contents as $item ) {
if( edd_has_user_purchased( get_current_user_id(), $item['id'] ) ) {