Skip to content

Instantly share code, notes, and snippets.

View mohammad-ahid's full-sized avatar

Mohammad Ahid Maulana Ismail mohammad-ahid

View GitHub Profile
@mohammad-ahid
mohammad-ahid / functions.php
Created January 16, 2017 14:39 — forked from unfulvio/functions.php
WordPress HTML Minification Class to compress HTML (removal of whitespaces, line breaks, new lines, comments). Preserves script comments (if removed might break some javascripts like Google Analytics or Adsense) and IE specific tags.
/* Minifies HTML and removes comments (except IE tags and comments within script tags)
*
* To disable compression of code portions, use '<!--wp-html-compression no compression-->' tag
*
* @see http://forrst.com/posts/Wordpress_Minify_output_HTML-29q
* @see http://www.intert3chmedia.net/2011/12/minify-html-javascript-css-without.html
*/
class WP_HTML_Compression
{
// Settings
@mohammad-ahid
mohammad-ahid / functions.php
Created January 16, 2017 14:45
Remove query strings from enqueued resources in WordPress
<?php
/**
* WordPress automatically adds query strings to enqueued static resources like stylesheets and scripts.
* This is meant for caching reasons (e.g. if a script version changes,
* it should prevent the client to use a cached copy of the old one).
* However, this feature can be omitted to improve site performance.
*/
function remove_query_strings_questionmark( $src ){
@mohammad-ahid
mohammad-ahid / style.css
Created January 16, 2017 14:46
CSS hack to hide Chrome default date picker styles
// @see http://stackoverflow.com/questions/11320615/disable-browser-native-datepicker
input::-webkit-calendar-picker-indicator{
display: none;
}
input[type="date"]::-webkit-input-placeholder{
visibility: hidden !important;
}
@mohammad-ahid
mohammad-ahid / functions.php
Created January 16, 2017 14:47 — forked from unfulvio/functions.php
WordPress: get only terms connected to posts of a specified type
<?php
/**
* Get Terms used by Post Type
* Fetches only terms actually used by posts of a specified post type
*
* @param string $taxonomy the taxonomy to look for terms
* @param string $post_type the post type to match the taxonomy terms found
*
* @return array the query result (an array of taxonomy terms as objects)
@mohammad-ahid
mohammad-ahid / robots.txt
Created January 16, 2017 14:48
Just a robots.txt file template which is suitable for WPEngine use
# All Agents
User-agent: *
Disallow: /blogs.dir
Disallow: /cgi-bin
Disallow: /wp-content/cache
Disallow: /wp-content/languages
Disallow: /wp-content/mu-plugins
Disallow: /wp-content/plugins
Disallow: /wp-content/upgrade
Disallow: /wp-admin