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 / gist:5caaf6fac729de4b7c768663389f7adf
Created May 19, 2016 15:52
WordPress Function, New Window on Class
add_action('wp_footer','open_link_new_window');
function open_link_new_window(){
?>
<script>
jQuery(function() {
function handle_cta( ev ) {
var href = jQuery( this ).attr( 'href' );
window.open( href, '_blank' );
return false;
}
@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 / gist:4e281c2a8db3447ee9bd2d5a1c924eb0
Created August 2, 2016 07:07
WooCommerce 2.6 Theme Compatibility CSS
/**
* My Account
*/
.woocommerce-MyAccount-navigation {
display: inline-block;
float: left;
width: 30% !important;
}
@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 / functions.php
Last active February 7, 2017 16:58
Redirect log - out users from Custom Post Type Singular
function logedout_singular_redirect() {
if (!is_user_logged_in() && ( is_singular( 'job_listing' ) )
) {
// feel free to customize the following line to suit your needs
wp_redirect(site_url('my-page-slug/'));
exit;
}
}
add_action('template_redirect', 'logedout_singular_redirect');
@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 / functions.php
Created July 31, 2017 13:16
Adds a class of "wp_is_mobile" to the body class of the page
function add_is_mobile_bodyclass($classes) {
//adds a class of "wp_is_mobile" to the body class of the page
if (wp_is_mobile()) {
$classes[] = 'wp_is_mobile';
}
return $classes;
}
add_filter('body_class','add_is_mobile_bodyclass');