EduardET

Untitled

Jul 6th, 2018
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.34 KB | None | 0 0
  1. function wpc_remove_parent_theme_function() {
  2.  
  3.     remove_action( 'after_setup_theme', 'extra_add_image_sizes' );
  4. }
  5.  
  6. function wpc_extra_add_image_sizes() {
  7.     $sizes = array(
  8.         'extra-image-huge'          => array(
  9.             'width'  => 1280,
  10.             'height' => 768,
  11.             'crop'   => true,
  12.         ),
  13.         'extra-image-single-post'   => array(
  14.             'width'  => 1280,
  15.             'height' => 640,
  16.             'crop'   => true,
  17.         ),
  18.         'extra-image-medium'        => array(
  19.             'width'  => 9999,
  20.             'height' => 9999,
  21.             'crop'   => false,
  22.         ),
  23.         'extra-image-small'         => array(
  24.             'width'  => 440,
  25.             'height' => 264,
  26.             'crop'   => true,
  27.         ),
  28.         'extra-image-square-medium' => array(
  29.             'width'  => 440,
  30.             'height' => 440,
  31.             'crop'   => true,
  32.         ),
  33.         'extra-image-square-small'  => array(
  34.             'width'  => 50,
  35.             'height' => 50,
  36.             'crop'   => true,
  37.         ),
  38.         'extra-image-730'   => array(
  39.             'width' => 730,
  40.             'height' => 450,
  41.             'crop' => true,
  42.         ),
  43.         'extra-image-220'   => array(
  44.             'width' => 220,
  45.             'height' => 132,
  46.             'crop' => true,
  47.         ),
  48.         'extra-image-150'   => array(
  49.             'width' => 150,
  50.             'height' => 90,
  51.             'crop' => true,
  52.         ), 
  53.     );
  54.  
  55.     foreach ( $sizes as $name => $size_info ) {
  56.         add_image_size( $name, $size_info['width'], $size_info['height'], $size_info['crop'] );
  57.     }
  58. }
  59.  
  60. add_action( 'after_setup_theme', 'wpc_remove_parent_theme_function', 0 );
  61. add_action('after_setup_theme' , 'wpc_extra_add_image_sizes');
Advertisement
Add Comment
Please, Sign In to add comment