• Resolved artsd

    (@artsd)


    Hi:
    Thanks for your work on this plugin. I see your notes concerning adding a code to the filter; I am trying to add additional sizes to the plugin for the images. Because I am not a coder, I tried to insert it into the .php file for the plugin, but created a fatal error. I used the editor in the plugin section. Please advise as to where (line#?)to place the code you listed, and what file. Your help is appreciated.
    Thanks so much,
    Art Golombek
    Custom Fit Marketing

    https://ww.wp.xz.cn/plugins/menu-image/

Viewing 1 replies (of 1 total)
  • Hi, add this code to your active theme functions.php:

    <?php
    add_filter( 'menu_image_default_sizes', function($sizes) {
    
      // remove the default 36x36 size
      unset($sizes['menu-36x36']);
    
      // add a new size
      $sizes['menu-50x50'] = array(50,50);
    
      // return $sizes (required)
      return $sizes;
    });
    ?>

    But if you have PHP version 5.3 or less than try this:

    <?php
    add_filter( 'menu_image_default_sizes', 'custom_menu_image_sizes_filter' );
    
    function custom_menu_image_sizes_filter($sizes) {
    
      // remove the default 36x36 size
      unset($sizes['menu-36x36']);
    
      // add a new size
      $sizes['menu-50x50'] = array(50,50);
    
      // return $sizes (required)
      return $sizes;
    
    }
    ?>

    But after adding new image size you need to re-upload images for menu (it’s a wordpress issue, not a plugin), or regenerate thumbnail with plugin like https://ru.ww.wp.xz.cn/plugins/regenerate-thumbnails/

Viewing 1 replies (of 1 total)

The topic ‘Changing default image sizes’ is closed to new replies.