Last active
September 6, 2016 23:26
-
-
Save adriannees/cecfb4c393dd77ecb59b62b7e731f019 to your computer and use it in GitHub Desktop.
Custom Image Size (WordPress)
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 | |
| //* Do NOT include the opening php tag shown above. Copy the code shown below. | |
| //* Add new custom image sizes | |
| add_image_size( 'image-name', 150, 100, TRUE ); | |
| /* DO NOT include the following it is for instructional purpose only | |
| * | |
| * Replace 'image-name' with the descriptive name you want to identify the new image size with. | |
| * DO NOT use thumb, thumbnail, medium, large, or post-thumbnail | |
| * The next two numbers are the width and height of the image in pixels respectively. | |
| * The final TRUE/FALSE is in response to assumed question "Should this image be cropped to these dimensions". If true it will be cropped. | |
| * If false the image will be scaled, not cropped (not recommended). If true can also specify where to crop in the form of an array. | |
| * x_crop_position accepts 'left', 'center', or 'right' and y_crop_position accepts 'top', 'center', or 'bottom' | |
| * ex. add_image_size( 'custom-size', 220, 200, array( 'left', 'top' ) ); // hard crops the top left 220x200 of image | |
| * | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment