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
/* ****************** | |
When considering performance speed, you may want to keep JS scripts organized beneath your overall page HTML. | |
This snippet allows most of the DOM to finish loading before running any dynamic scripts. | |
****************** */ | |
function dcg_move_scripts_to_footer() { | |
if( !is_admin() ) { | |
remove_action('wp_head', 'wp_print_scripts'); | |
remove_action('wp_head', 'wp_print_head_scripts', 9); | |
remove_action('wp_head', 'wp_enqueue_scripts', 1); |
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( 'customize_register', 'prefix_remove_css_section', 15 ); | |
/** | |
* Remove the additional CSS section, introduced in 4.7, from the Customizer. | |
* @param $wp_customize WP_Customize_Manager | |
*/ | |
function prefix_remove_css_section( $wp_customize ) { | |
$wp_customize->remove_section( 'custom_css' ); | |
} |
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
// remove dashicons | |
function wpdocs_dequeue_dashicon() { | |
if (current_user_can( 'update_core' )) { | |
return; | |
} | |
wp_deregister_style('dashicons'); | |
} | |
add_action( 'wp_enqueue_scripts', 'wpdocs_dequeue_dashicon' ); |
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 | |
/** | |
* Class Minify_CSS_Compressor | |
* @package Minify | |
*/ | |
/** | |
* Compress CSS | |
* | |
* This is a heavy regex-based removal of whitespace, unnecessary |
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( 'wp_enqueue_scripts', 'dequeue_woocommerce_cart_fragments', 11); | |
function dequeue_woocommerce_cart_fragments() { | |
if (is_front_page() || is_single() ) wp_dequeue_script('wc-cart-fragments'); | |
} |
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
// Lazyload Converter | |
function add_lazyload($content) { | |
$content = mb_convert_encoding($content, 'HTML-ENTITIES', "UTF-8"); | |
$dom = new DOMDocument(); | |
@$dom->loadHTML($content); | |
// Convert Images | |
$images = []; |
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: Filename-based cache busting | |
* Version: 0.3 | |
* Description: Filename-based cache busting for WordPress scripts/styles. | |
* Author: Dominik Schilling | |
* Author URI: http://wphelper.de/ | |
* Plugin URI: https://dominikschilling.de/880/ | |
* | |
* License: GPLv2 or later |
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
// Minify HTML codes when page is output. | |
add_action('wp_loaded','my_minify_html'); | |
function my_minify_html(){ | |
/** | |
* use html_compress($html) function to minify html codes. | |
*/ | |
ob_start('html_compress'); | |
} | |
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 | |
/** | |
* Open Graph protocol for WordPress | |
* @version 0.9.2 | |
* @author makoto_kw | |
* @link https://gist.github.com/3399585 | |
*/ | |
// key into custom fields for description. Default is for All in One SEO Pack | |
define('WP_OGP_POST_DESCRIPTION_KEY', '_aioseop_description'); |
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 | |
/** | |
* Open Graph Tags | |
* | |
* Add Open Graph tags so that Facebook (and any other service that supports them) | |
* can crawl the site better and we provide a better sharing experience. | |
* | |
* @link http://ogp.me/ | |
* @link http://developers.facebook.com/docs/opengraph/ | |
*/ |