Created
March 2, 2021 20:56
-
-
Save perezdans/4e302e3dacdf89d3a7a592747220e74d to your computer and use it in GitHub Desktop.
Añadir tamaños de imagenes (miniaturas) a WordPress y dar la opción de elegirlas al añadirlas a un post
This file contains 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 | |
function jpd_add_image_sizes() { | |
add_image_size( 'pw-thumb', 300, 100, true ); | |
add_image_size( 'pw-large', 600, 300, true ); | |
} | |
add_action( 'init', 'jpd_add_image_sizes' ); | |
function jpd_show_image_sizes($sizes) { | |
$sizes['pw-thumb'] = __( 'Custom Thumb', 'perezdans' ); | |
$sizes['pw-large'] = __( 'Custom Large', 'perezdans' ); | |
return $sizes; | |
} | |
add_filter('image_size_names_choose', 'jpd_show_image_sizes'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment