Skip to content

Instantly share code, notes, and snippets.

@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';
//Allow svg
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
@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;
}
@pogla
pogla / style.css
Last active May 10, 2018 12:38
iOS Flexbox fix CSS
/* iOS Fix for Flexbox */
.flexboxclass:first-child {
flex:1;
-webkit-box-flex:1;
-webkit-flex:1;
}
@pogla
pogla / main.sql
Last active May 12, 2018 16:23
Deleta all WordPress users from database
DELETE FROM wp_usermeta WHERE user_id NOT in (1);
DELETE FROM wp_users WHERE ID NOT in (1);
@pogla
pogla / readme.md
Last active May 29, 2018 10:12
WP CLI install development plugins
wp plugin install wp-crontrol user-switching transients-manager query-monitor post-meta-inspector disable-emails email-log
wp plugin activate wp-crontrol user-switching transients-manager query-monitor post-meta-inspector disable-emails email-log
@pogla
pogla / readme.md
Last active July 23, 2018 09:55
Cron Local By Flywheel
add_filter( 'cron_request', function( $args ) {

   $args['url'] = set_url_scheme( $args['url'], 'http' );
   return $args;

} );
@pogla
pogla / imagemagick.md
Created March 1, 2019 11:10
Resize all images in subfolders using imagemagick
find ./ -name "*.jpg" -exec magick mogrify -resize 100x100 {} \;
@pogla
pogla / .lando.yml
Last active June 24, 2019 15:31
WordPress lando config
name: pagename
recipe: wordpress
config:
env: dev
xdebug: true
webroot: .
via: nginx
proxy:
appserver:
- pagename.lndo.site
@pogla
pogla / rename.php
Last active January 21, 2020 10:49
Rename all images in a folder based on seed keyword array
<?php
$seed_words = [
'word1',
'word2',
'word3',
];
$files = [];