Skip to content

Instantly share code, notes, and snippets.

View rocknroyal's full-sized avatar

Matthew Walker rocknroyal

View GitHub Profile
@rocknroyal
rocknroyal / .htaccess
Last active November 21, 2018 18:20
503 Redirect | Maintenance Page ( Apache | .htaccess )
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !/maintenance [NC]
RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|jpeg|js|png) [NC]
RewriteRule .* /maintenance.html [R=503,L]
</IfModule>
# serve custom 503 response
ErrorDocument 503 /maintenance.html
@rocknroyal
rocknroyal / Jquery Equal Height Images
Created August 1, 2014 07:49
If you are not generating image sizes server side, use this with CSS to hide the image overflow based on the smallest image's div containers height. Full Impimentation here: http://mattroyal.co.za/2014/05/jquery-equal-height-images-for-fluid-responsive-websites/
jQuery(window).load(function() {
var allImages = jQuery('.image-container img');
var imageSmallest = allImages[0];
jQuery(allImages).each(function() {
// find smallest image height
if (jQuery(this).height() < jQuery(imageSmallest).height())
imageSmallest = jQuery(this);
});
@rocknroyal
rocknroyal / Automatically Enable Yoast Breadcrumbs
Created July 24, 2014 15:45
Automatically / Programatically Enable WordPress SEO Breadcrumbs by Yoast if the plugin is activate. (Add to functions.php)
/**
* Automatically turn on breadcrumbs if it is not enabled
*/
function royal_auto_yoast_enable_breadcrumbs() {
if ( function_exists('yoast_breadcrumb') ) {
$option = get_option( 'wpseo_internallinks' );
if( $option['breadcrumbs-enable'] == '' ) {