Skip to content

Instantly share code, notes, and snippets.

Basilis Kanonidis Basilakis

Block or report user

Report or block Basilakis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Basilakis
Basilakis / cloudways-mautic.sh
Created Feb 20, 2020 — forked from heathdutton/cloudways-mautic.sh
Recommended cron tasks for Mautic 2 in Cloudways.
View cloudways-mautic.sh
# Recommended cron tasks for Mautic 2 in Cloudways.
# All tasks are ran as www-data
# Output is ignored to avoid log file overhead.
# --quiet is used to reduce MySQL overhead on some tasks.
# --max-contacts is used to prevent one object's backlog from locking updates for other object.
# SEGMENTS
# Update all segments.
*/5 * * * * www-data php applications/mautic/public_html/app/console mautic:segments:update --max-contacts=10000 --quiet >/dev/null 2>&1
View astra-woocommerce-sensei-wrappers.php
<?php // don't copy this line to your file.
// disable the default wrappers for the WooCommerce Sensei templates.
global $woothemes_sensei;
remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 );
remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 );
/**
* Load the correct wrappers for the WooCommerce Sensei layouts.
*/
View Cloudways API PHP Example.php
<?php
//Use this function to contact CW API
/**
*
* @param string $method GET|POST|PUT|DELETE
* @param string $url relative URL for the call
* @param string $accessToken Access token generated using OAuth Call
* @param type $post Optional post data for the call
* @return object Output from CW API
*/
@Basilakis
Basilakis / functions.php
Last active Dec 26, 2019
Change Status from Processing to Complete over WooCommerce
View functions.php
/**
* Auto Complete all WooCommerce orders.
*/
add_filter( 'woocommerce_payment_complete_order_status', 'cg_update_order_status', 10, 2 );
function cg_update_order_status( $order_status, $order_id ) {
$order = new WC_Order( $order_id );
if ( 'processing' == $order_status && ( 'on-hold' == $order->status || 'pending' == $order->status || 'failed' == $order->status ) ) {
@Basilakis
Basilakis / functions.php
Created Sep 30, 2019
Create Filters to be used over Post Type to short by category(ies)
View functions.php
function filter_cars_by_taxonomies( $post_type, $which ) {
// Apply this only on a specific post type
if ( 'car' !== $post_type )
return;
// A list of taxonomy slugs to filter by
$taxonomies = array( 'manufacturer', 'model', 'transmission', 'doors', 'color' );
foreach ( $taxonomies as $taxonomy_slug ) {
View eventon.php
/**
* Event On Modificacitons for Columns
*/
// Remove the Default WordPress Columns
add_filter('manage_ajde_events_posts_columns', function ( $columns )
{
unset($columns['author'], $columns['tags']);
return $columns;
} );
// Remove the EventOn Event Type 2 column
@Basilakis
Basilakis / variations.php
Created Jul 24, 2018
Additional Variation Images for WooCommerec
View variations.php
<?php
// add this to functions.php
add_action('woocommerce_after_single_product','custom_woocommerce_additional_variation_images');
function custom_woocommerce_additional_variation_images(){
?>
<script type="text/javascript">
(function($) {
$(window).load(function(){
@Basilakis
Basilakis / dynamic-fees.php
Last active Mar 27, 2018
Dynamic Fees for Shipping Per Payment GateWay for WooCommerce
View dynamic-fees.php
add_action('init', 'cg_init');
function cg_init() {
add_action('woocommerce_cart_calculate_fees', 'cg_add_fee');
add_action('wp_footer', 'cg_footer', 9999);
}
function cg_footer() {
?>
<script type="text/javascript">
@Basilakis
Basilakis / eventon-custom-field.php
Created Feb 11, 2018
eventON Custom Field Functionality
View eventon-custom-field.php
<?php
/*
Plugin Name: eventON single custom field
Plugin URI: https://eventon.com
Description: A text field for eventON submit event form
Author: Basilis Kanonidis
Version: 2.0
License: GPLv2 or later
*/
@Basilakis
Basilakis / hextorgba.php
Created Dec 26, 2017
Convert HEX value to RGBA
View hextorgba.php
function mk_convert_rgba($colour, $alpha)
{
if (!empty($colour)) {
if ($alpha >= 0.95) {
return $colour; // If alpha is equal 1 no need to convert to RGBA, so we are ok with it. :)
} else {
if ($colour[0] == '#') {
$colour = substr($colour, 1);
}
if (strlen($colour) == 6) {
You can’t perform that action at this time.