Skip to content

Instantly share code, notes, and snippets.

View ValeriiVasyliev's full-sized avatar
🏄
Focusing

Valerii Vasyliev ValeriiVasyliev

🏄
Focusing
View GitHub Profile
@ValeriiVasyliev
ValeriiVasyliev / edit-woocommerce-checkout-template.php
Created March 1, 2021 20:46 — forked from bekarice/edit-woocommerce-checkout-template.php
Add content and notices to the WooCommerce checkout - sample code
/**
* Each of these samples can be used - note that you should pick one rather than add them all.
*
* How to use WC notices: https://github.com/woothemes/woocommerce/blob/master/includes/wc-notice-functions.php#L96
* Tutorial: http://www.skyverge.com/blog/edit-woocommerce-templates/
**/
/**
* Add a content block after all notices, such as the login and coupon notices.
*
@ValeriiVasyliev
ValeriiVasyliev / refund_order.php
Created May 14, 2021 09:03 — forked from igorbenic/refund_order.php
How to Create WooCommerce Refunds Programmatically | ibenic.com/how-to-create-woocommerce-refunds-programmatically
<?php
/**
* Process Order Refund through Code
* @return WC_Order_Refund|WP_Error
*/
function ibenic_wc_refund_order( $order_id, $refund_reason = '' ) {
$order = wc_get_order( $order_id );
// IF it's something else such as a WC_Order_Refund, we don't want that.
@ValeriiVasyliev
ValeriiVasyliev / Custom_Mailer.php
Created May 27, 2021 07:32 — forked from A-Maged/Custom_Mailer.php
inline images with wp_mail
<?php
/*
* Send HTML Emails with inline images
*/
class Custom_Mailer
{
public $email_attachments = [];
public function send($to, $subject, $body, $headers, $attachments)
@ValeriiVasyliev
ValeriiVasyliev / WordpressAsDependency.md
Created July 13, 2021 08:37 — forked from cullylarson/WordpressAsDependency.md
Installing Wordpress as a dependency

Wordpress as a Dependency

How to install Wordpress as a dependency in your project, without including the WP install in version control.

Rationale

In the spirit of The Twelve Factor App, we want to "explicitly declare and isolate dependencies". Wordpress doesn't really promote this idea out of the box, so we have jump through a few hoops to do it. This document describes a simple method to include Wordpress as a dependency in this way.

General Idea

@ValeriiVasyliev
ValeriiVasyliev / wc-defer-order-emails.php
Created July 20, 2021 07:28 — forked from damiencarbery/wc-defer-order-emails.php
Defer WooCommerce emails for a few minutes - Defer WooCommerce emails for a specified time after the normal delivery time. https://www.damiencarbery.com/2020/04/defer-woocommerce-emails-for-a-few-minutes/
<?php
/*
Plugin Name: Defer WooCommerce emails for a few minutes
Plugin URI: https://www.damiencarbery.com/2020/04/defer-woocommerce-emails-for-a-few-minutes/
Description: Defer WooCommerce emails for a specified time after the normal delivery time.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.5
*/
@ValeriiVasyliev
ValeriiVasyliev / gist:71a7961cb1b1fefd83817f1ba686b6b9
Created August 12, 2021 07:00 — forked from westonruter/gist:5475349
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
cache_fragment_output( 'unique-key', 3600, function () {
functions_that_do_stuff_live();
these_should_echo();
});
*/
function cache_fragment_output( $key, $ttl, $function ) {
@ValeriiVasyliev
ValeriiVasyliev / xampp_php7_xdebug.md
Created September 22, 2021 07:46 — forked from odan/xampp_php7_xdebug.md
Installing Xdebug for XAMPP
@ValeriiVasyliev
ValeriiVasyliev / .gitlab-ci.yml
Created October 20, 2021 20:20 — forked from khoipro/.gitlab-ci.yml
Deploy from GitLab to WPEngine (Tested)
stages:
- deploy_dev
- deploy_staging
- deploy_live
before_script:
- 'which ssh-agent || ( apk add --update openssh )'
- apk add --update bash
- apk add --update git
- eval $(ssh-agent -s)
@ValeriiVasyliev
ValeriiVasyliev / markdown-text-101.md
Created October 27, 2021 09:25 — forked from matthewzring/markdown-text-101.md
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

Sweet Styles

Italics *italics* or _italics_

Underline italics __*underline italics*__