• I’m registering new image sizes in WordPress funcion.php theme file this way:

     add_theme_support( 'post-thumbnails' );
     add_image_size( 'image-480', 480, 9999 );
     add_image_size( 'image-640', 640, 9999 );
     add_image_size( 'image-720', 720, 9999 );
     add_image_size( 'image-960', 960, 9999 );
     add_image_size( 'image-1160', 1168, 9999 );

    The problem that the options to choose this sizes doesn’t appear. Only FULL, LARGE, MEDIUM and THUMBNAIL, the default sizes.

    This always worked for me before.

    PS: I’m trying with images begger than 1200)

    • This topic was modified 3 years, 2 months ago by Carreiro.
    • This topic was modified 3 years, 2 months ago by Carreiro.
    • This topic was modified 3 years, 2 months ago by Carreiro.
    • This topic was modified 3 years, 2 months ago by Carreiro.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @carreiro

    Are you passing this size while echoing specific image?, Like

    <?php
    $image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'image-480');
    actual URL = $image_url[0];
    ?>
    • This reply was modified 3 years, 2 months ago by yogeshyadav20.
    Thread Starter Carreiro

    (@carreiro)

    Thanks for the reply.

    No, in the past I never had to do this.

    Where I have to put this code? I have to make this for all sizes?

    Please, let me know…

    Thanks in advance

    When you say “options to choose this size” do you mean when you go to add the image to a post in the editor? If so, here’s an article with a code snippet that adds your image sizes to the Image Size dropdown.
    https://wpmudev.com/blog/wordpress-image-sizes/

    Here’s the snippet, adapted to your image size names.

    add_filter('image_size_names_choose', 'wpsf_add_image_sizes');
    function wpsf_add_image_sizes($sizes) {
      return array_merge($sizes, array(
        'image-480' => '480px Wide',
        'image-640' => '640px Wide',
        'image-720' => '720px Wide',
        'image-960' => '960px Wide',
        'image-1160' => '1160px Wide',
      ));
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Registering New Image Sizes not Worling’ is closed to new replies.