Skip to content

Instantly share code, notes, and snippets.


Sergey Mochalov proweb

View GitHub Profile
aguilar1181 / wp-preload.php
Last active Dec 4, 2022
add to WordPress themes functions.php to preload assets without a plugin
View wp-preload.php
* Preloading WordPress assets without a plugin.
* Change function name to something more unique.
* Priority is set to 0 to include as high in the <head> DOM as possible. Change priority if needed.
* Use WordPress is_page() to target specific page or is_front_page() to target ONLY homepage as in Option #1
* If asset needs to be preloaded globally use Option #2.
* For multiple assets clone the link tag instead of the entire echo block.
* Change 'as' attribute accordingly. Values for 'as' can be found here
* Use abolute paths. For external assets paste the url, for internal assets use WordPress functions to construct URL.
View extraButton.js
import _ from 'lodash';
import PropTypes from 'prop-types';
import React, { Fragment } from 'react';
import { BlockControls } from '@wordpress/block-editor';
import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
import {
} from '@wordpress/components';
homu9 / gist:7d68b59aeb24c6f02455b776263041a2
Created Apr 13, 2022
Bulk update plugins for runcloud
View gist:7d68b59aeb24c6f02455b776263041a2
# Change directory to /home
cd /home
# Iterate through all users directories
for user in * ; do
# For every webapp under the user directory
# Count wp-config files to make sure its Wordpess
ivandoric / wl-api.php
Last active Jan 11, 2023
WordPress Rest API Custom Endpoints Video Tutorials Notes - Check out the videos: and
View wl-api.php
* Plugin Name: Custom API
* Plugin URI:
* Description: Crushing it!
* Version: 1.0
* Author: Art Vandelay
* Author URI:
View minimal-analytics-snippet.js
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
mihdan / wp-image-placeholder.php
Last active Dec 12, 2022
Заменяет битые ссылки на кратинки в WordPress на заглушки. Удобно, например на тестовом сайте, чтобы не переносить фотки с боевого.
View wp-image-placeholder.php
* Plugin Name: Mihdan: Image Placeholder
namespace Mihdan\Image_Placeholder;
$images = array(
// Обычные
leurdo / gist:c81f10472cfdd403cf608068b0f054d7
Last active Sep 9, 2018
wiki post type and taxonomy registration, gives permalink structure
View gist:c81f10472cfdd403cf608068b0f054d7
// don't load directly
if (!defined('ABSPATH')) die('-1');
class CreditznatokAddwiki
private static $_instance;
static function getInstance()
# Regolith aka Un-Bedrock
# "But what if we need to hand it off to another agency?" No more!
# This script converts a Bedrock site to a normal WordPress structure.
# Run it from the root of a Bedrock project.
# Created by Nathan Knowler and Daniel Roe
echo "Converting Bedrock to a normal WordPress file structure..."
bph / psl-theme-test.txt
Last active Apr 12, 2022
Blocks for Themes Test
View psl-theme-test.txt
<!-- wp:paragraph -->
<p><a href=""></a></p>
<!-- /wp:paragraph -->
<!-- wp:heading {"className":"eplus-oOhLNH"} -->
<h2 class="eplus-oOhLNH">Common Blocks / Formatting / Layout Elements / Widgets and Embeds</h2>
<!-- /wp:heading -->
<!-- wp:list {"className":"eplus-eI3gin"} -->
<ul class="eplus-eI3gin"><li><a href="#images">Images</a> (Single image, cover image, gallery </li><li><a href="#quotes">Pull Quote / Quote</a></li><li><a href="#verse">Verse</a></li><li><a href="#buttons">Buttons</a></li><li><a href="#socialicons" data-type="internal" data-id="#socialicons">Social Icons</a></li><li><a href="#columns">Columns </a> Text (only) columns / Columns experimental</li><li><a href="#cover" data-type="internal" data-id="#cover">Cover</a> with CAT + button</li><li><a href="#paragraphs">Paragraph</a> </li><li><a href="#audio">Audio</a> </li><li><a href="#video">Video</a></li><li><a href="#w
srikat / test.html
Created May 8, 2018
Dummy Content for Gutenberg
View test.html
<!-- wp:heading -->
<h2>Heading Block (H2)</h2>
<!-- /wp:heading -->
<!-- wp:heading -->
<h3>You are looking at one. (H3)</h3>
<!-- /wp:heading -->
<!-- wp:heading -->
<h2>Subhead Block</h2>