Skip to content

Instantly share code, notes, and snippets.

:atom:
coding

Sergey Mochalov proweb

:atom:
coding
Block or report user

Report or block proweb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ivandoric
ivandoric / wl-api.php
Created May 5, 2019
Creating WordPress Rest API Custom Endpoints
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
Created Nov 27, 2018
Заменяет битые ссылки на кратинки в 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..."
@stesab92
stesab92 / .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';
@MatthieuScarset
MatthieuScarset / gist:47b57f2e3bd4afee39a81ae5a7c3dc28
Created Dec 27, 2016
Drupal 8 - Get canonical node URL in TWIG
View gist:47b57f2e3bd4afee39a81ae5a7c3dc28
{{ path('entity.node.canonical', {'node': node.id }) }}
You can’t perform that action at this time.