Skip to content

Instantly share code, notes, and snippets.

View emilushi's full-sized avatar
🇦🇱
Working Remotely

Eduard Milushi emilushi

🇦🇱
Working Remotely
View GitHub Profile
@emilushi
emilushi / Setup-php-code-sniffer-with-wordpress-coding-standard.md
Last active June 14, 2022 12:20
Step by step guide how to setup PhpStorm with PHP_CodeSniffer and WordPress Coding Standards

Please follow the above steps to setup PhpStorm with PHP CodeSniffer and WordPress Coding Standards.

The first step is only for PhpStorm and doesn't do all the work

  1. Open Preferences menu on PhpStorm from there find the Editor menu and navigate to Code Style > PHP
    1. in the top right corner click on Set From and select WordPress from the drop-down menu WP Coding Standards
  2. Install composer globally if you don't have it installed already with the following commands.
    1. Check official documentation how to install composer on your machine here or follow the below steps if your on Linux,Unix or macOs
    2.    # This is the fastest way for Linux/Unix and macOs
      

Keybase proof

I hereby claim:

  • I am emilushi on github.
  • I am emilushi (https://keybase.io/emilushi) on keybase.
  • I have a public key whose fingerprint is EA73 AE5D 760D 35D4 A4E0 ECFA BA46 1CEC 1AB3 AC8D

To claim this, I am signing this object:

@emilushi
emilushi / functions.php
Last active May 8, 2019 20:41
WooCommerce dont allow Subscription and Regular product on same checkout.
<?php
use WC_Subscriptions_Cart;
add_filter('woocommerce_add_to_cart_validation', function(){
//If WooCommerce Subscriptions is installed handle the things...
if (in_array('woocommerce-subscriptions/woocommerce-subscriptions.php', apply_filters('active_plugins', get_option('active_plugins')), true)) {
$cartContent = WC()->cart->get_cart();
@emilushi
emilushi / buttons.scss
Created May 8, 2019 20:20
SASS Loop to set properties based on predefined list.
$schema1: white $white $white;
$schema2: core-brand-color $color__brand-green $color__brand-green;
$schema3: secondary-brand-color $color__brand-blue $color__brand-blue;
$schema4: black $black $black;
$schema5: coral coral coral;
$schema6: darkblue darkblue darkblue;
$schema7: darkgrey darkgrey darkgrey;
$schema8: lightblue $color__brand-lightblue $color__brand-lightblue;
$schema9: purple purple purple;
$schema10: red $color__brand-red $color__brand-red;
@emilushi
emilushi / BootstrapNavWalker.php
Created May 6, 2019 20:33
Bootstrap 4 WordPress Nav Walker
<?php
/**
* A custom WordPress nav walker class to implement the Bootstrap 4 navigation style in a custom theme using the WordPress built in menu manager.
* Edited from orignal version of Edward McIntyre: https://github.com/twittem/wp-bootstrap-navwalker
*
* @author Eduard Milushi
*/
class BootstrapNavWalker extends Walker_Nav_Menu
{
@emilushi
emilushi / functions.php
Created May 2, 2019 11:29
Convert WooCommerce variations to custom radio input.
<?php
/**
* Output radio buttons on WooCommerce variations.
*/
add_filter('woocommerce_dropdown_variation_attribute_options_html', static function ($html, $args) {
/** @var array $args */
$args = wp_parse_args(apply_filters('woocommerce_dropdown_variation_attribute_options_args', $args), [
'options' => false,
'attribute' => false,
@emilushi
emilushi / functions.php
Last active March 11, 2019 19:52
Stop Weglot from translating emails sent using wp_mail
<?php
if (class_exists(\WeglotWP\Actions\Email_Translate_Weglot::class) && ! in_array('weglot/weglot.php', apply_filters('active_plugins', get_option('active_plugins')), true)) {
remove_filter('wp_mail', [\WeglotWP\Actions\Email_Translate_Weglot::class, 'weglot_translate_emails']);
}
@emilushi
emilushi / ObjectListener.php
Last active February 15, 2019 12:50 — forked from soyuka/ObjectListener.php
Streaming big json files the good way with php with https://soyuka.me/streaming-big-json-files-the-good-way/
<?php
namespace Fry;
use JsonStreamingParser\Listener;
/**
* This implementation allows to process an object at a specific level
* when it has been fully parsed
*/