WordPress.org

Ready to get started?Download WordPress

Forums

Custom image sizes (1 post)

  1. TA003
    Member
    Posted 9 months ago #

    Hi,

    I want to add multiple 'custom image sizes' to my site. Adding one works fine, but i can't seem to add more. Here is my code:

    // Add image size
    function custom_image_sizes() {
      add_theme_support('post-thumbnails');
    	add_image_size('front-page', 310, 300, true);
    	add_image_size('sidebar', 270, 175, true);
    }
    add_action('after_setup_theme', 'custom_image_sizes');
    
    function add_custom_sizes( $imageSizes ) {
      $my_sizes = array(
    		'front-page' => 'Front-page',
    		'sidebar' => 'Sidebar'
    	);
    	return array_merge( $imageSizes, $my_sizes );
    }
    add_filter( 'image_size_names_choose', 'add_custom_sizes' );

    The front-page image size works fine, but the sidebar image size doest'n appear when uploading media.

    Any ideas of what i'm doing wrong?
    Thanks

Reply

You must log in to post.

About this Topic

Tags

No tags yet.