Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Code is poetry

Mikhail Kobzarev mihdan

:octocat:
Code is poetry
View GitHub Profile
View defaults-2.php
<?php
function tlap_plugin_default_values(){
$defaults = array(
'tlap_add_analytics_option' => array(
'tlap_excludepage' => '',
'tlap_timer_delay' => '5000',
),
'tlap_add_analytics_option_counters' => array(
@mihdan
mihdan / DNS Prefetch domains
Last active Aug 20, 2021 — forked from lukecav/DNS Prefetch domains
WP Rocket - Advanced Options Prefetch DNS requests examples
View DNS Prefetch domains
//maps.googleapis.com
//maps.gstatic.com
//fonts.googleapis.com
//fonts.gstatic.com
//ajax.googleapis.com
//apis.google.com
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
//youtube.com
View wpseo-pagination-canonical.php
<?php
function return_canon () {
$canon_page = get_pagenum_link( 1 );
return $canon_page;
}
function canon_paged() {
if ( is_paged() ) {
add_filter( 'wpseo_canonical', 'return_canon' );
}
View wpseo-remove-prev-next-links.php
View wp-extend-recent-posts-widget.php
<?php
add_filter(
'widget_posts_args',
function ( $args, $instance ) {
if ( isset( $instance['cpt'] ) ) {
$args['post_type'] = $instance['cpt'];
}
if ( isset( $instance['order_by'] ) ) {
View migrate_repo.sh
# Assume we are in your home directory
cd ~/
# Clone the repo from GitLab using the `--mirror` option
$ git clone --mirror git@your-gitlab-site.com: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 Jun 2, 2021
Add Revolution Slider to one of your WordPress site’s Pages
View wp-revolution-slider-insert.php
<?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 — forked from silent1mezzo/0fixup.md
On undoing, fixing, or removing commits in git
View 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 Apr 30, 2021
Yoast SEO: register extra replacement to get content before read more tag
View wpseo-register-replacement-for-read-more.php
<?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 Mar 22, 2021 — 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.
View fix-authors-bug-5.7.php
<?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.