A list of everything that *could* go in the <head>
of your document
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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%); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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:// |