This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'wp_constrain_dimensions', 'mcoc_constrain_dimensions', 11, 5 ); | |
| function mcoc_constrain_dimensions( $dimensions, $current_width, $current_height, $max_width, $max_height ) { | |
| // Stop if desired size is not post thumbnail | |
| if ( ( $max_width != get_option( 'thumbnail_size_w' ) ) || ( $max_height != get_option( 'thumbnail_size_h' ) ) ) return $dimensions; | |
| // Ensure cropped width is at least post thumbnail width | |
| if ( $dimensions[0] >= $max_width ) return $dimensions; | |
| if ( $current_height > $max_height ) { | |
| return [ | |
| $max_width, | |
| $max_width * $current_height / $current_width |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: Redirect to Canonical | |
| Description: Redirect posts to canonical URL when accessed via secondary category URL slugs. | |
| Version: 1.0 | |
| Author: Greg Perham | |
| License: GPL2 | |
| */ | |
| defined( 'ABSPATH' ) || exit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_hook( 'AdminAreaHeadOutput', 1, 'sg_admin_head_output' ); | |
| function sg_admin_head_output( $vars ) { | |
| return <<<HTML | |
| <style id="custom-admin-css"> | |
| /* Quick and dirty admin dark mode */ | |
| html, body { background-color: #242525 !important; } | |
| #contentarea, #sidebar, .navbar-collapse > ul > .has-dropdown > ul { filter: invert(); } | |
| </style> | |
| HTML; | |
| } |
OlderNewer