Skip to content

Instantly share code, notes, and snippets.

Avatar
🏡
work from home

Sergey Mochalov proweb

🏡
work from home
View GitHub Profile
@ivandoric
ivandoric / wl-api.php
Last active Aug 3, 2020
Creating WordPress Rest API Custom Endpoints Video Tutorial Note. - Check out the video: https://www.youtube.com/watch?v=C2twS9ArdCI
View wl-api.php
<?php
/**
* Plugin Name: Custom API
* Plugin URI: http://chrushingit.com
* Description: Crushing it!
* Version: 1.0
* Author: Art Vandelay
* Author URI: http://watch-learn.com
*/
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
mihdan / wp-image-placeholder.php
Last active Jan 8, 2020
Заменяет битые ссылки на кратинки в WordPress на заглушки. Удобно, например на тестовом сайте, чтобы не переносить фотки с боевого.
View wp-image-placeholder.php
<?php
/**
* Plugin Name: Mihdan: Image Placeholder
*/
namespace Mihdan\Image_Placeholder;
$images = array(
// Обычные
'https://placeimg.com/640/480/animals',
@leurdo
leurdo / gist:c81f10472cfdd403cf608068b0f054d7
Last active Sep 9, 2018
wiki post type and taxonomy registration, gives permalink structure http://site.ru/wiki/category/subcategory/post
View gist:c81f10472cfdd403cf608068b0f054d7
<?php
// don't load directly
if (!defined('ABSPATH')) die('-1');
class CreditznatokAddwiki
{
private static $_instance;
static function getInstance()
@knowler
knowler / regolith.sh
Last active Aug 12, 2019
Regolith aka Un-Bedrock | "But what if we need to hand it off to another agency?" No more!
View regolith.sh
#!/bin/bash
# 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..."
@srikat
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>
@stephensabatini
stephensabatini / .htaccess
Created Jul 17, 2017
Snippet of Security Tweaks for the .htaccess.
View .htaccess
# Deny access to include files.
<Files ~ "\.inc$">
Order Allow,Deny
Deny from All
</Files>
# Deny access to hidden files.
RedirectMatch 403 /\..*$
# Deny access to folders.
View gist:090d857c58f555fe0af966ec5cd9431f
jQuery(document).ready(function () {
// calendar
uikit_jcalendar();
// button
uikit_jcalendar_btn('#news_created_btn', 'uk-button-primary', 'calendar');
uikit_jcalendar_btn('#news_publish_up_btn', 'uk-button-secondary', 'future');
});
// calendar
@soderlind
soderlind / change-theme-root.php
Last active Jan 21, 2017
Change WordPress theme root to a folder in your plugin (src/assets)
View change-theme-root.php
<?php
/**
* Sample use:
* WordPres Customizer is dependant on functionality in the theme. Just in case
* the current theme doesn't support WordPress Customizer we'll use a theme
* that supports it.
*/
class NN {
private $theme_name = 'twentysixteen';
You can’t perform that action at this time.