Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #363294

    I am trying to add an option for an image size in the “Attachment Display Settings” dropdown and have had no luck.

    I found this thread and tried to follow along to make it work. I went in to the child theme functions.php file and added the code from the thread (edited for my dimensions and file name), and had no luck. The new image size has been defined as bio_pic with dimensions of 200 x 200, thumbnails have been updated via the Simple Image Sizes plugin, and all changes saved.

    Could someone help me with the step-by-step and some copy/paste code to accomplish this? I’m very good at following directions, but not so good at knowing what I’m doing.

    If it helps, I have WordPress 4.0.1 and am using a child theme with Enfold 3.0.4, and I also have the Simple Image Sizes plugin v. 3.2.

    #363481

    Hi omnisara!

    Thank you for using Enfold.

    Use this on functions.php:

    // New thumbnail size
    $avia_config['imgSize']['newthumbnail'] = array('width'=>200,  'height'=>200);
    
    function avia_change_image_size_array($sizes) {
    	global $avia_config;
    		
    	$avia_config['selectableImgSize'] = array(
    	'square' 				=> __('Square','avia_framework'),
    	'featured'  			=> __('Featured Thin','avia_framework'),
    	'featured_large'  		=> __('Featured Large','avia_framework'),
    	'portfolio' 			=> __('Portfolio','avia_framework'),
    	'gallery' 				=> __('Gallery','avia_framework'),
    	'entry_with_sidebar' 	=> __('Entry with Sidebar','avia_framework'),
    	'entry_without_sidebar'	=> __('Entry without Sidebar','avia_framework'),
    	'extra_large' 			=> __('Fullscreen Sections/Sliders','avia_framework'),
    	// New thumbnail size selection
    	'new_thumbnail'         => __('New Thumbnail','avia_framework'),
    	);
    	
    	$sizes = array_merge($sizes, $avia_config['selectableImgSize']);
    
    	return $sizes; 	
    }
    add_filter( 'image_size_names_choose', 'avia_change_image_size_array', 10, 1);

    Sometimes, it takes a while to flush the image size selection. Try to install the Simple Size Image plugin then add a random thumbnail size. Update then save changes. Go to a page then check if the New Thumbnail is added on the Attachment Display Settings > Size dropdown.

    Best regards,
    Ismael

    #364810

    That worked like a dream, first try! Thank you so much for your help. You guys are great. Feel free to close this out this thread.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Adding Image Size to "Attachment Display Settings"’ is closed to new replies.