Skip to content

Instantly share code, notes, and snippets.

@pogla
pogla / readme.md
Last active January 24, 2019 10:01
Load remote images if they don't exist locally - WordPress

NGINX

Serve all assets:

location ~ ^(/wp-content/themes|/wp-content/uploads)/.*\.(jpe?g|gif|css|png|js|ico|pdf|m4a|mov|mp3|webm|mp4)$ {
	rewrite ^ https://mydomain.com$request_uri?
	permanent;
	access_log off;
}
//Allow svg
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
@pogla
pogla / functions.php
Last active May 12, 2018 16:21
Rename page in pagination url
/*Change url page to stran*/
if ( ! function_exists( 'lr_page_to_seite' ) )
{
register_activation_hook( __FILE__ , 'lr_flush_rewrite_on_init' );
register_deactivation_hook( __FILE__ , 'lr_flush_rewrite_on_init' );
add_action( 'init', 'lr_page_to_seite' );
function lr_page_to_seite()
{
$GLOBALS['wp_rewrite']->pagination_base = 'stran';