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 / migrate_repo.sh
Created July 6, 2021 16:41 — forked from mariozig/migrate_repo.sh
Migrate repo from GitLab to GitHub Full blog post @ http://ruby.zigzo.com/2015/03/23/moving-from-gitlab-to-github/
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror [email protected]:mario/my-repo.git
# Change into newly created repo directory
$ cd ~/my-repo.git
# Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks.
@mihdan
mihdan / wp-revolution-slider-insert.php
Last active June 2, 2021 21:14
Add Revolution Slider to one of your WordPress site’s Pages
<?php
<!-- Load the slider with "slider1" alias every time -->
<?php putRevSlider("slider1") ?>
<!-- Load the slider with "slider1" alias only on the homepage only -->
<?php putRevSlider("slider1", "homepage") ?>
<!-- Load the slider with "slider1" alias only on a specific page with default permalinks -->
@mihdan
mihdan / 0fixup.md
Created May 14, 2021 11:19 — forked from silent1mezzo/0fixup.md
On undoing, fixing, or removing commits in git

A git choose-your-own-adventure!

This document is an attempt to be a fairly comprehensive guide to recovering from what you did not mean to do when using git. It isn't that git is so complicated that you need a large document to take care or your particular problem, it is more that the set of things that you might have done is so large that different techniques are needed depending on exactly what you have done and what you want to have happen.

@mihdan
mihdan / wpseo-register-replacement-for-read-more.php
Last active April 30, 2021 08:25
Yoast SEO: register extra replacement to get content before read more tag
<?php
add_action(
'wpseo_register_extra_replacements',
/**
* Yoast SEO: register extra replacement to get content before read more tag
*/
function () {
wpseo_register_var_replacement(
'%%read_more%%',
function () {
@mihdan
mihdan / fix-authors-bug-5.7.php
Created March 22, 2021 08:41 — forked from kagg-design/fix-authors-bug-5.7.php
MU-Plugin to temporary fix the problem with the list of authors on post edit page with Block Editor.
<?php
/**
* MU-Plugin to temporary fix the problem with the list of authors on post edit page with Block Editor.
* With WP 5.7, user with the Editor role is unable to search across long list of authors in Author combobox.
*
* @package kagg-design
*/
/**
* Fixes bug in WP 5.7 with author selection on post edit in admin.
@mihdan
mihdan / wp-searchwp-wpallimport-customizations.php
Last active March 3, 2021 14:12 — forked from jchristopher/searchwp-customizations.php
How to Integrate SearchWP with Wp All Import
<?php
/**
* WP All Import SearchWP PRE-import routine
*
* @link https://searchwp.com/documentation/knowledge-base/content-imports/
*/
add_action( 'pmxi_before_xml_import', function( $import_id ) {
\SearchWP::$indexer->pause();
@mihdan
mihdan / wp-debug-with-query-monitor.php
Created March 2, 2021 18:17
Обертка над Query Monitor для вывода дебага в его лог
<?php
function d( ...$vars ) { //phpcs:ignore PHPCompatibility.LanguageConstructs.NewLanguageConstructs.t_ellipsisFound
foreach ( $vars as $var ) {
do_action( 'qm/debug', var_export( $var, true ) ); // phpcs:ignore
}
}
@mihdan
mihdan / wp-disable-query-monitor-on-frontend.php
Created March 2, 2021 17:14
Отключаем Query Monitor на фронте
<?php
add_filter( 'option_active_plugins', static function( $plugins ) {
foreach ( $plugins as $plugin ) {
if ( $plugin === 'query-monitor/query-monitor.php' && wp_get_environment_type() === 'production' ) {
unset( $plugins[ $plugin ] );
}
}
return $plugins;
} );
@mihdan
mihdan / elementor-default-editor.php
Created February 27, 2021 16:34 — forked from wppunk/elementor-default-editor.php
Make the Elementor as default editor
<?php
/**
* Make the Elementor as default editor.
*
* @since 1.0.0
* @author wppunk
* @link https://github.com/wppunk/
*/
namespace wppunk\Elementor;
@mihdan
mihdan / wp-add-custom-mime-type.php
Created February 26, 2021 08:39
Add custom mime type for WordPress
<?php
function mihdan_edit_upload_types( $existing_mimes = array() ) {
// allow .woff
$existing_mimes['woff'] = 'font/woff';
// disallow .jpg files
unset( $existing_mimes['jpg'] );
return $existing_mimes;
}