Skip to content

Instantly share code, notes, and snippets.

View viktorbijlenga's full-sized avatar

Viktor Bijlenga viktorbijlenga

View GitHub Profile
@viktorbijlenga
viktorbijlenga / .htaccess
Last active September 21, 2023 22:41
load images from a different Wordpress enviroment
# place above all other rewrite rules if using a CMS or program that redirects all request to index.php file (e.g. WordPress, Drupal, Laravel, etc...)
# if a file or directory does not exist on the local host, 302 redirect the request to the production host so the browser doesn't cache the file in case you replace the file locally
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect WordPress uploads
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule wp-content/uploads/(.*)$ http://REPLACEWITHYOURDOMAIN.COM/wp-content/uploads/$1 [R=302,L,NC]
</IfModule>
@viktorbijlenga
viktorbijlenga / htaccess-redirect-load-images-from-production
Last active April 13, 2023 11:55 — forked from rxnlabs/htaccess-redirect-load-images-from-production
htaccess - Redirect image and file request from the localhost to the production host - Wordpress
# Place on top of Wordpress own redirect rules
# If a file (-f) or directory (-d) doesn't exist on the local host,
# A 302 redirect request is made to the production host.
<IfModule mod_rewrite.c>
RewriteEngine On
#Redirect WordPress uploads
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
@viktorbijlenga
viktorbijlenga / userstyle.css
Last active December 26, 2015 05:49
Custom styles for The Verges liveblog.Use with Stylish for Chrome: http://bit.ly/RujlXc Screenshot of the style: http://cl.ly/S699 I would recommend using the fullscreen mode in Chrome as well. Just press CMD+SHIFT+F to enter fullscreen.
body {
background: #222;
color: #FFF;
font-size: 20px!important;
line-height: 1.5em!important;
}
#content {
width: 800px!important;
}
@viktorbijlenga
viktorbijlenga / functions.php
Created September 30, 2013 10:55
Hide Wordpress update message on production server.
// Hide update nag on the production server
$production = 'http://PRODUCTIONURL.com';
$check_url = home_url();
function hideUpdateNag() {
remove_action( 'admin_notices', 'update_nag', 3 );
}
if ( $production == $check_url ) {
add_action('admin_menu','hideUpdateNag');
@viktorbijlenga
viktorbijlenga / functions.php
Created June 28, 2013 09:59
Remove <p> from Wordpress images. Add to functions.php
function filter_ptags_on_images($content){
return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
}
add_filter('the_content', 'filter_ptags_on_images');