Skip to content

Instantly share code, notes, and snippets.

View mihdan's full-sized avatar
:octocat:
Code is poetry

Mikhail Kobzarev mihdan

:octocat:
Code is poetry
View GitHub Profile
@mihdan
mihdan / set_acf_pro_license.php
Created December 12, 2019 19:10 — forked from campusboy87/set_acf_pro_license.php
Automatic activation of ACF license via PHP. The code adds the key to the option in the desired format, and adds the domain to the list of trusted domains tracked in the ACF profile, so that the update is successful. The code can be used as a MU plugin, a regular plugin, or inserted into the theme code.
<?php
add_action( 'acf/init', 'set_acf_pro_license' );
function set_acf_pro_license() {
global $acf_instances;
if ( isset( $acf_instances['ACF_Admin_Updates'] ) && ! get_option( 'acf_pro_license' ) ) {
/**
* @var ACF_Admin_Updates $acf
@mihdan
mihdan / woocommerce-category-toggle.css
Created November 27, 2019 15:12 — forked from Garconis/woocommerce-category-toggle.css
WooCommerce | Expand and collapse child categories with custom toggle in the sidebar widget | https://i.gyazo.com/e1a39ed551096444134324bb429722bb.mp4
/* - woo cat toggling elements, injected via jQuery - */
/* make list item be relative, to be able to position toggle within this item, if desired */
#sidebar .widget_product_categories ul.product-categories > li.cat-parent {
position: relative;
}
/* the new toggle element wrapper, which is added via jQuery */
#sidebar .widget_product_categories ul.product-categories > li.cat-parent .woo-cat-toggle {
cursor: pointer;
display: inline-block;
@mihdan
mihdan / oneflow.md
Created November 21, 2019 15:02 — forked from skinny85/oneflow.md
a git branching model (one branch / original + hybrid variant) WIP

oneflow

A flow based on this article

AR: my comments will start with four hashes

Original approach

Feature branches

@mihdan
mihdan / plugin.php
Created September 9, 2019 14:45 — forked from craigsimps/plugin.php
<?php
/**
* Generico Core
*
* Core plugin, holding theme-agnostic functionality specific to the site.
*
* @package Generico\Core
* @author Craig Simpson <[email protected]>
* @license MIT
* @link https://craigsimpson.scot
@mihdan
mihdan / gist:b31cd90bbd096e25d3d0aa449d5b78c8
Created August 28, 2019 12:21 — forked from CFranc111/gist:ca7b7ab6108ce293365f380d5e99b6b2
Wordpress add lazy loading all content
function enzothecat_add_lazy_loading($content) {
$content = preg_replace('/src="/', 'loading="lazy" src="', $content);
return $content;
}
add_filter('the_content', 'enzothecat_add_lazy_loading');
@mihdan
mihdan / wp-rocket-disable-inline-css-minify.php
Created July 15, 2019 07:54 — forked from glueckpress/wp-rocket-disable-inline-css-minify.php
[WordPress][WP Rocket] Disable minification of inline CSS when Minify HTML is enabled.
<?php
/**
* Disables Minify for inline CSS.
* https://github.com/wp-media/wp-rocket/blob/v2.11.3/inc/front/minify.php#L72
*/
add_filter( 'rocket_minify_html_options', function ( $html_options ) {
$html_options = array();
return $html_options;
@mihdan
mihdan / Cron jobs
Created July 8, 2019 19:34 — forked from lukecav/Cron jobs
EWWW Image Optimizer - Cron jobs
wp_ewwwio_ngg2_optimize_cron_interval
wp_ewwwio_ngg_optimize_cron_interval
wp_ewwwio_flag_optimize_cron_interval
wp_ewwwio_media_optimize_cron_interval
wp_ewwwio_image_optimize_cron_interval
{
"repositories": [
{
"type": "package",
"package": {
"name": "advanced-custom-fields/advanced-custom-fields-pro",
"version": "5.1.3",
"type": "wordpress-plugin",
"dist": {
"type": "zip",
@mihdan
mihdan / widget.js
Created April 30, 2019 17:49 — forked from atronov/widget.js
widget
(function(w, n) { w[n]
= w[n] || [];
w[n].push(() => {
w.YandexZen.renderWidget({
clid: ['9110', '9111'], // partner's identifier (for testing purposes only)
container: '.widget-container', // element selector or dom-element where the widget will be inserted
successCallback: function () { // called when the widget is inserted successfully
console.log('widget mount succeed'); // replace function body with your handler or delete this field
},
failCallback: function () { // called in case of problem while widget insertion
@mihdan
mihdan / wp-disable-elementor-widgets.php
Last active March 4, 2019 10:34 — forked from zorca/disable-elementor-widgets.php
Отключает все виджеты Elementor
<?php
/**
* @link https://github.com/elementor/elementor/issues/3136#issuecomment-361602293
*/
global $elementor_widget_blacklist;
$elementor_widget_blacklist = [
,'common'
,'heading'
,'image'