Skip to content

Instantly share code, notes, and snippets.

@schilke
schilke / .htaccess
Last active Apr 8, 2019
Extend .htaccess (with Cachify directives) for better Caching/Compression
View .htaccess
# To make sure
mod_gzip_on Yes
# Optional
AddDefaultCharset UTF-8
# BEGIN ADD MIME TYPES
<IfModule mod_mime.c>
AddType text/css .css
AddType text/x-component .htc
@schilke
schilke / functions.php
Created Apr 28, 2015
Remove Date/Time information from Postinfo to avoid showing up in SERPs
View functions.php
<?php
/****************************************************************************************************************
* ATTENTION! Don't copy the above line if you're going to use this in your functions.php - just the code below *
****************************************************************************************************************/
function jsc_remove_modified_date(){
if( is_page() ){
@schilke
schilke / functions.php
Last active Jan 27, 2018
Add Open Graph to Meta Tags
View functions.php
<?php
/****************************************************************************************************************
* ATTENTION! Don't copy the above line if you're going to use this in your functions.php - just the code below *
****************************************************************************************************************/
function fb_opengraph() {
global $post;
if(is_single()) { // article or post - not front page or archive
@schilke
schilke / functions.php
Created Apr 20, 2015
Make embedded videos fully responsive
View functions.php
/* Add responsive container to embeds */
function jsc_embed_html( $html ) {
return '<div class="video-container">' . $html . '</div>';
}
add_filter( 'embed_oembed_html', 'jsc_embed_html', 10, 3 );
add_filter( 'video_embed_html', 'jsc_embed_html' );
@schilke
schilke / functions.php
Last active Aug 29, 2015
Remove query strings
View functions.php
<?php
// don't copy above line when copying and pasting into your functions.php
// Remove WP version number from js and css files.
// more exact function, removes also "&"
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) || strpos( $src, '&ver=' ) )
$src = remove_query_arg( 'ver', $src );
@schilke
schilke / .htaccess
Last active Aug 29, 2015
Redirect rules on change of domain name
View .htaccess
# Redirect all requests from olddomain.com to www.newdomain.com
# tell the server to activate mod_rewrite
RewriteEngine On
# What's the redirect base (i.e. root or subdirectory)
RewriteBase /
# Either check if the request goes to the old domain
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$ [NC]
@schilke
schilke / gist:088de7c1d8f30e8ba294
Created Dec 1, 2014
Breadcrumbs in Genesis Nav Extras (really, really Q&D Hack)
View gist:088de7c1d8f30e8ba294
<?php
//* Do NOT include the opening php tag
// Discussion on LinkedIn: http://j.mp/1y5Mrgi
//* Modify breadcrumb arguments.
add_filter( 'genesis_breadcrumb_args', 'jsc_breadcrumb_args' );
function jsc_breadcrumb_args( $args ) {
$args['sep'] = ' / ';
$args['prefix'] = '</ul><div class="breadcrumb">'; // the </ul> closes the navigation list
@schilke
schilke / functions.php
Last active Jul 17, 2021
How to load CSS files asynchronously in WordPress (using Scott Jehl's "loadCSS")
View functions.php
<?php
// This is the cleaner code per request of a thread in the LinkedIn group "WordPress"
// ...
// register and enqueue loadCSS
function load_scripts_and_styles() {
// register loadCSS
wp_register_script( 'load-css-async', get_stylesheet_directory_uri() . '/path/to/js/loadCSS.js', array(), '', false );
@schilke
schilke / keybase.md
Created Apr 5, 2014
Gist for keybase.io verification
View keybase.md

Keybase proof

I hereby claim:

  • I am schilke on github.
  • I am schilke (https://keybase.io/schilke) on keybase.
  • I have a public key whose fingerprint is 4A08 15E2 CFC2 B202 DFA9 D76E FDD0 0043 86BA 2482

To claim this, I am signing this object:

@schilke
schilke / Contract Killer 3.md
Last active Dec 11, 2018 — forked from malarkey/Contract Killer 3.md
German translation of Andy Clarke's popular ‘killer contract’ for web designers and developers (work in progress)
View Contract Killer 3.md