Skip to content

Instantly share code, notes, and snippets.

View cabrerahector's full-sized avatar

Héctor Cabrera cabrerahector

View GitHub Profile
@jeffaspenburg
jeffaspenburg / htaccess-wordpress-prod-images
Created August 9, 2019 02:05
WordPress htaccess Production to Local Media
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Pull Image Files From Live Server
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.*\.(png|jpe?g|gif|ico|svg)) https://production-site.com//$1 [NC,L]
RewriteRule ^index\.php$ - [L]
@jentanbernardus
jentanbernardus / vhost.md
Last active August 20, 2024 03:36
Setting Up Virtual Hosts in MAMP on Windows

1. Edit MAMP Apache configuration to include Virtual Hosts configuration

In File Explorer, go to C:\MAMP\conf\apache and open httpd.conf with your text editor.

Find this line:

# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
@kingkool68
kingkool68 / maybe-sideload.php
Created November 21, 2020 04:19
Two WordPress functions for maybe side loading URLs to the media library. Useful for content migrations that need to be run multiple times without producing duplicate downloads.
<?php
/**
* Example useage:
*
* maybe_sideload_image( 'https://dummyimage.com/600x400/000/fff.png' ); // Downloads image to the media library and returns an attachment ID
* maybe_sideload_image( 'https://dummyimage.com/600x400/000/fff.png' ); // Returns an attachment ID as the image has already been downloaded and added to the media library
*/
/**