Skip to content

Instantly share code, notes, and snippets.

View Basilakis's full-sized avatar
🏠
Working from home

Basilis Kanonidis Basilakis

🏠
Working from home
View GitHub Profile
@Basilakis
Basilakis / plugin.php
Created November 26, 2015 05:47 — forked from mathetos/plugin.php
Dependent Plugin Activation/Deactivation and Alert
<?php
/*
* Dependent Plugin Activation/Deactivation
*
* Sources:
* 1. https://pippinsplugins.com/checking-dependent-plugin-active/
* 2. http://10up.com/blog/2012/wordpress-plug-in-self-deactivation/
*
*/
@Basilakis
Basilakis / edd-custom-payment-statuses.php
Created December 20, 2015 14:14 — forked from bekarice/edd-custom-payment-statuses.php
Add custom EDD payment statuses
/**
* Adds new payment statuses to array of available statuses
*/
function sww_add_edd_payment_statuses( $payment_statuses ) {
$payment_statuses['invoice_paid'] = 'Invoice Paid';
$payment_statuses['in_progress'] = 'Project in progress';
return $payment_statuses;
}
@Basilakis
Basilakis / wc-custom-order-status-icon.php
Created December 20, 2015 14:16 — forked from bekarice/wc-custom-order-status-icon.php
Add WooCommerce custom order status icon
/**
* Adds icons for any custom order statuses
* Tutorial: http://www.skyverge.com/blog/changing-woocommerce-custom-order-status-icons/
**/
add_action( 'wp_print_scripts', 'skyverge_add_custom_order_status_icon' );
function skyverge_add_custom_order_status_icon() {
if( ! is_admin() ) {
return;
}
@Basilakis
Basilakis / wc-admin-new-order-email-change-subject.php
Last active February 27, 2020 22:06 — forked from bekarice/wc-admin-new-order-email-change-subject.php
Add customer name to WooCommerce Admin New Order Email subject
// Adds customer first and last name to admin new order email subject
function skyverge_add_customer_to_email_subject( $subject, $order ) {
$subject = 'New Customer Order - (# ' . $order->get_order_number() . ') from ' . $order->get_billing_first_name() . ' ' . $order->get_billing_last_name();
return $subject;
};
add_filter( 'woocommerce_email_subject_new_order', 'skyverge_add_customer_to_email_subject', 10, 2 );
@Basilakis
Basilakis / edd-create-coupon-slack.php
Created July 6, 2016 12:05 — forked from zackkatz/edd-create-coupon-slack.php
EDD Create Coupon from Slack - Allow creating a coupon `/coupon $20` or `/coupon 20%` in Slack
<?php
/*
Plugin Name: EDD Create Coupon from Slack
Plugin URL: http://gravityview.co
Description: Allow creating a coupon `/coupon [%]` in Slack
Version: 1.0
Author: Katz Web Services, Inc.
Author URI: http://katz.co
Contributors: katzwebservices
*/
@Basilakis
Basilakis / wp-query-ref.php
Created October 19, 2016 12:14 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@Basilakis
Basilakis / gist:c93e0cfc5842f2193fd8825ba712f017
Created December 21, 2016 18:25 — forked from pippinsplugins/gist:ececad5d57e3946c5af3
Adds billing address fields to Restrict Content Pro
<?php
/*
* Plugin Name: Restrict Content Pro - Collect Billing Address
* Description: Collect customers billing address during registration through Restrict Content Pro
* Author: Pippin Williamson
* Version: 1.0
*/
class RCP_Billing_Address {
@Basilakis
Basilakis / redirect-after-publish-v1.php
Created January 10, 2017 12:42
WordPress: Redirect to post/page after publishing
<?php
// Redirect to the post/page itself after publishing or updating a post in
// WordPress. This code is from the WordPress forum [1], modified so it doesn't
// redirect when saving a draft.
// [1]: http://wordpress.org/support/topic/redirect-to-new-post-after-publish
add_filter('redirect_post_location', function($location)
@Basilakis
Basilakis / custom_wp_is_mobile.php
Created July 30, 2017 19:36 — forked from sachyya/custom_wp_is_mobile.php
This gist is to use WordPress inbuilt function wp_is_mobile excluding the ipad view port
function custom_wp_is_mobile() {
static $is_mobile;
if ( isset($is_mobile) )
return $is_mobile;
if ( empty($_SERVER['HTTP_USER_AGENT']) ) {
$is_mobile = false;
} elseif (
strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false
@Basilakis
Basilakis / plugin.php
Created October 7, 2017 15:31
Make customers vendors FES
<?php
add_action( 'edd_complete_purchase', 'fes_add_buyers_as_vendors', 10, 1 );
function fes_add_buyers_as_vendors( $payment_id ){
$customer_id = edd_get_payment_customer_id( $payment_id );
$db_user = new FES_DB_Vendors();
if ( $db_user->exists( 'id', $customer_id ) {
return;
}