Code Snippets

Remove Versioning in WordPress CSS and JS Scripts

Remove versioning from CSS and JS scripts in your WordPress theme. This helps increase page speed scores and isn’t needed past development. function remove_cssjs_ver( $src ) { if( strpos( $src, ‘?ver=’ ) ) $src = remove_query_arg( ‘ver’, $src ); return $src; } add_filter( ‘style_loader_src’, ‘remove_cssjs_ver’, 10, 2 ); add_filter( ‘script_loader_src’, ‘remove_cssjs_ver’, 10, 2 );

Insert Custom Image Sizes into Select Boxes

This snippet allows you to select image sizes by name and dimensions in drop down boxes throughout WordPress. Add this to mu-plugins/add_image_size.php Change names and sizes as needed. /* ADD CUSTOM IMAGE SIZES */ if ( function_exists( ‘add_image_size’ ) ) { add_image_size( ‘portfolio-archive’, 510, 400, true ); add_image_size( ‘portfolio-single’, 768, 0, false ); } add_filter( …

Insert Custom Image Sizes into Select Boxes Read More »

Scroll to Top
Scroll to Top