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
@jchristopher
jchristopher / searchwp-customizations.php
Last active April 8, 2021 13:13
How to Integrate SearchWP with Content Imports
<?php
// Disable SearchWP's automatic integration with WP All Import.
add_filter( 'searchwp\integration\wp-all-import', '__return_false' );
add_action( 'pmxi_before_xml_import', function( $import_id ) {
\SearchWP::$indexer->pause();
}, 10 );
add_action( 'pmxi_saved_post', function( $post_id ) {
<?php
class CNWS_Schema {
public function __construct() {
$this->hooks();
}
@ihorvorotnov
ihorvorotnov / functions.php
Last active March 17, 2021 10:01
Painless 3rd party marketing scripts in WordPress
<?php
// Enqueue all js codes combined in a single file.
function enqueue_theme_assets()
{
wp_enqueue_script(
'trackers',
get_stylesheet_directory_uri() . '/js/trackers.js',
null,
null,
@kholodovz
kholodovz / yandex-map-lazy.js
Created February 25, 2020 20:15
yandex map lazyload
//Переменная для включения/отключения индикатора загрузки
var spinner = $('.ymap-container').children('.loader');
//Переменная для определения была ли хоть раз загружена Яндекс.Карта (чтобы избежать повторной загрузки при наведении)
var check_if_load = false;
//Необходимые переменные для того, чтобы задать координаты на Яндекс.Карте
var myMapTemp, myPlacemarkTemp;
//Функция создания карты сайта и затем вставки ее в блок с идентификатором "map-yandex"
function init () {
var myMapTemp = new ymaps.Map("map-yandex", {
@kagg-design
kagg-design / functions.php
Last active January 12, 2022 12:00
Fix performance problem with woodmart autoload.
<?php
if( ! function_exists( 'woodmart_autoload' ) ) {
function woodmart_autoload($className) {
global $woodmart_files;
$className = ltrim($className, '\\');
$fileName = '';
$namespace = '';
if ($lastNsPos = strripos($className, '\\')) {
$namespace = substr($className, 0, $lastNsPos);
@campusboy87
campusboy87 / set_acf_pro_license.php
Last active December 12, 2019 19:10
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
@sybrew
sybrew / tsf-custom-image-generator.php
Created October 11, 2019 20:40
Example snippet to prepend and append image generators for The SEO Framework.
<?php
// Do not include this PHP opening tag if PHP is already opened...
// Ref: https://theseoframework.com/docs/using-filters/
add_filter( 'the_seo_framework_image_generation_params', 'my_tsf_custom_image_generation_args', 10, 3 );
/**
* Adjusts image generation parameters.
*
* @link https://theseoframework.com/docs/api/filters/#append-image-generators-for-social-images
@kagg-design
kagg-design / gist:7cbda38a3ce76c0502748f8ddbc9bebe
Created September 5, 2019 07:00
Remove current action or filter from plugin
<?php
/**
* Remove current action or filter from plugin
*
* @param string $class_name Class name enqueueing the action.
* @param null $action_name Action name.
*/
function remove_plugin_action( $class_name, $action_name = null ) {
global $wp_filter;
@abelcheung
abelcheung / firefox-viewsource-customize.md
Last active May 28, 2023 18:18
Customizing Firefox view-source style -- Solarized Dark theme with wallpaper

Customizing Firefox view-source style

TL;DR

  1. Open (or create) chrome/userContent.css under your Firefox profile folder
  2. Append attached CSS content and save file
  3. Toggle toolkit.legacyUserProfileCustomizations.stylesheets in Firefox about:config
  4. Restart Firefox

firefox view-source style customization

@mihdan
mihdan / wp-all-import-category-relations.php
Last active April 11, 2023 09:45
Соотношение категорий из YML и сайт в плагине WPAllImport
<?php
/**
* Plugin Name: Mihdan: WP All Import Extended
* Description: Патчим плагин под наши нужды - хуюжды, чтобы ломать сайт-хуяйт от пользователя-хуёльзователя по имени админ-хуидмин
* Plugin URI: https://roomble.com/shop
* Author: Mikhail Kobzarev
* Author URI: https://roomble.com/shop
* Version: 2.1.0
*/