Skip to content

Instantly share code, notes, and snippets.

<?php
/*-----------------------------------------------------------------------------------*/
/* Do not remove these lines, sky will fall on your head.
/*-----------------------------------------------------------------------------------*/
define( 'MTS_THEME_NAME', 'schema' );
define( 'MTS_THEME_VERSION', '3.1.2' );
require_once( dirname( __FILE__ ) . '/theme-options.php' );
if ( ! isset( $content_width ) ) {
$content_width = 680;
@bewho
bewho / tags-in-head.md
Created December 19, 2017 14:49 — forked from varundevpro/tags-in-head.md
A list of everything that could go in the <head> of your document

HEAD

CC0 Contributors

A list of everything that *could* go in the <head> of your document

Table of Contents

@bewho
bewho / defer-wp-scripts.php
Created December 20, 2017 07:24 — forked from Antoinebr/defer-wp-scripts.php
defer-wp-scripts.php
<?php
/*
function to add async and defer attributes
Will only work if the scripts are enqueued with wp_enqueue_script()
*/
function defer_js_async($tag){
## 1: list of scripts to defer.
$scripts_to_defer = array(
'owl-carousel.min.js',
@bewho
bewho / functions.php
Created December 20, 2017 14:41 — forked from tyohan/functions.php
Functions to make scripts async and defer on WordPress Seventeen Theme
function add_defer_attribute($tag, $handle) {
// add script handles to the array below
$scripts_to_defer = array(
'html5',
'jquery',
'jquery-migrate',
'wp-embed',
'twentyseventeen-skip-link-focus-fix',
'jquery-scrollto',
'twentyseventeen-global',
@bewho
bewho / script_loading.php
Created December 20, 2017 14:45 — forked from digisavvy/script_loading.php
Functions to boos script loading performance
add_filter( 'script_loader_tag', 'wsds_defer_scripts', 10, 3 );
function wsds_defer_scripts( $tag, $handle, $src ) {
$id = get_the_ID();
// The handles of the enqueued scripts we want to defer
$defer_scripts = array(
'jquery-waypoints',
"fl-builder-layout-$id",
'devicepx',
'tmls_ba_throttle_debounce',
'tmls_mousewheel',
@bewho
bewho / clean_html_xss.php
Created December 20, 2017 15:25 — forked from nikitastore/clean_html_xss.php
PHP: clean_html AND xss_clean
<?php
function clean_html(&$html) {
libxml_use_internal_errors(true) AND libxml_clear_errors();
$whitelist = array(
"#text",
"a" => array("target", "href", "name", "type", "rel", "download"),
"img" => array("src", "alt", "width", "height"),
"table" => array("width"),
@bewho
bewho / clear-cache-after-update.php
Created December 22, 2017 01:06 — forked from carlosonweb/clear-cache-after-update.php
Clear Cache After Theme or Plugin Update
add_action( 'upgrader_process_complete', function() {
//rocket cache
if ( function_exists( 'rocket_clean_domain' ) ) {
rocket_clean_domain();
}
// wp-super-cache
if ( function_exists( 'wp_cache_clear_cache' ) ) {
wp_cache_clear_cache();
@bewho
bewho / power-wordpress-tweaks.php
Created January 12, 2018 05:29 — forked from ankurk91/power-wordpress-tweaks.php
Power WordPress Tweaks
<?php
/*
Plugin Name: Power WP Tweaks
Plugin URI: http://ankurk91.github.io/
Description: Some common tweaks to optimize WP Site
Version: 1.0
Author: ankurk91
Author URI: http://ankurk91.github.io/
License: MIT
*/
@bewho
bewho / gradients.scss
Created January 12, 2018 06:19 — forked from joshuadavidnelson/gradients.scss
A couple of background gradients from uiGradients.com with a mixin
@mixin linear-gradient( $deg, $fromColor, $toColor ) {
background: -webkit-linear-gradient($deg, $fromColor, $toColor); /* Chrome 10+, Saf5.1+ */
background: -moz-linear-gradient($deg, $fromColor, $toColor); /* FF3.6+ */
background: -ms-linear-gradient($deg, $fromColor, $toColor); /* IE10 */
background: -o-linear-gradient($deg, $fromColor, $toColor); /* Opera 11.10+ */
background: linear-gradient($deg, $fromColor, $toColor); /* W3C */
}
.gradient-ash {
@include linear-gradient(90deg, #606c88 10%, #3f4c6b 90%);
@bewho
bewho / force-ssl-all-pages.php
Created January 12, 2018 06:23 — forked from joshuadavidnelson/force-ssl-all-pages.php
Force SSL on all pages
<?php
/**
* Force SSL on all pages
*
* @author Joshua David Nelson, joshuadnelson.com
**/
add_action( 'template_redirect', 'jdn_force_ssl' );
function jdn_force_ssl() {
// force all pages to https://