Skip to content

Instantly share code, notes, and snippets.

@visualpropaganda
visualpropaganda / Exclude Pages from sitemap
Created April 1, 2019 14:36
Exclude Pages from sitemap created by Yoast
// exclude My Account, Cart, and Checkout from sitemap created by Yoast SEO
// Woocommerce handles the no-index of these oages through robots.txt
add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', function () {
return array( 311, 322 );
} );
@visualpropaganda
visualpropaganda / wp-revision-limit
Last active June 10, 2016 18:03
Limit Wordpress Post Revisions
//disable WP Post Revisions
//insert above the ‘ABSPATH’ otherwise it won’t work
define('AUTOSAVE_INTERVAL', 300); // seconds
define('WP_POST_REVISIONS', false); // or any number of revisions <ou like to keep (ex. 3)
@visualpropaganda
visualpropaganda / image.php
Created May 9, 2016 15:33
Disable Image Attachment Pages Using A WP Redirect
<?php
global $post;
if ( $post && $post->post_parent ) {
wp_redirect( get_permalink( $post->post_parent ), 301 );
exit;
} else {
wp_redirect( home_url( '/' ), 301 );
exit;
}
@visualpropaganda
visualpropaganda / WP:.htaccess
Last active August 29, 2015 14:01
WP: htaccess + gzip etc.
# MAINTENANCE-PAGE REDIRECT
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^193\.158\.164\.23
RewriteCond %{REQUEST_URI} !/underconstruction.html$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /underconstruction.html [R=302,L]
</IfModule>
# END MAINTENANCE-PAGE REDIRECT
@visualpropaganda
visualpropaganda / CSS: Horizontal Ruler Styling without <hr>
Created April 4, 2013 17:40
CSS: Horizontal Ruler Styling without <hr>
/*
* Horizontal Ruler without <hr> (can be put in media queries instead of html)
*/
.hdr-primary:before {
border: 1px solid $bg-html;
border-width: 1px 0;
content: "";
display: block;
height: 2px;
@visualpropaganda
visualpropaganda / box-sizing.css
Created February 28, 2013 11:47
CSS: box-sizing: border box
/* apply a natural box layout model to all elements */
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
@visualpropaganda
visualpropaganda / gist:5032024
Created February 25, 2013 18:24
HTML: Skiplinks
<div id="skiplinks">
<ul class="clearfix">
<li class="visuallyhidden"><a href="#main-nav">Zur Hauptnavigation</a><span class="visuallyhidden"> . </span></li>
<li class="visuallyhidden"><a href="#content">Zum Inhalt</a><span class="visuallyhidden"> . </span></li>
<li class="visuallyhidden"><a href="#siteinfo">Zu den Kontakt-Informationen</a><span class="visuallyhidden"> . </span></li>
</ul>
</div>
<!-- Ende skiplinks -->
@visualpropaganda
visualpropaganda / gist:4585619
Last active May 19, 2017 12:59 — forked from matt-bailey/gist:2497771
CSS: Image Replacement
/* H5BP image replacement: http://nicolasgallagher.com/another-css-image-replacement-technique/ */
.ir {
border: 0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@visualpropaganda
visualpropaganda / php.ini
Created January 21, 2013 12:02
Performance: php.ini (gzip on)
zlib.output_compression = on
@visualpropaganda
visualpropaganda / Performance: Add gzip for js
Last active December 11, 2015 10:18
Performance: Add gzip for js
# Add gzip compression for javascript
RewriteEngine on
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule (.*)\.js$ $1\.js.gz [L]
AddType "text/javascript" .js.gz
AddEncoding gzip .gz