Skip to content

Instantly share code, notes, and snippets.

@schilke
schilke / .htaccess
Last active April 8, 2019 19:11
Extend .htaccess (with Cachify directives) for better Caching/Compression
# 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 April 28, 2015 08:21
Remove Date/Time information from Postinfo to avoid showing up in SERPs
<?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 January 27, 2018 03:41
Add Open Graph to Meta Tags
<?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 April 20, 2015 11:56
Make embedded videos fully responsive
/* 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 February 24, 2023 13:41
Remove query strings
<?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 August 29, 2015 14:13
Redirect rules on change of domain name
# 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 December 1, 2014 20:33
Breadcrumbs in Genesis Nav Extras (really, really Q&D Hack)
<?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 February 23, 2023 18:53
How to load CSS files asynchronously in WordPress (using Scott Jehl's "loadCSS")
<?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 April 5, 2014 12:28
Gist for keybase.io verification

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 December 11, 2018 21:39 — forked from malarkey/Contract Killer 3.md
German translation of Andy Clarke's popular ‘killer contract’ for web designers and developers (work in progress)