Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #26290

    I am trying to generate new image sizes in a child theme.

    I have added this to the child theme functions.php file:

    $avia_config['imgSize']['product-thumb'] 			 	= array('width'=>250,  'height'=>250);						// smaller product images

    $avia_config['slectableImgSize'] = array(
    'product-thumb' => __('Product Thumb','avia_framework'),
    );

    After I run regenerate thumbnails, I do see that the new image is on FTP. But when I am using the builder and use the image element I do not see the new size available in the “Attachment Display Settings” dropdown.

    Am I missing something to add this to that dropdown?

    #129949

    Hey!

    Try to wrap your code into a function and use the init hook to add your thumbnail size to the avia_config array: http://www.kriesi.at/support/topic/override-the-global-avia_config-within-child-functionsphp

    Best regards,

    Peter

    #129950

    Hey Peter,

    Thanks for the link. In doing how you suggested it removes other items in the drop down Display Settings dropdown.

    Before the code I have 9 choices:

    Thumbnail – 80 × 80

    Medium – 300 × 300

    Full Size – 900 × 900

    Square – 180 × 180

    Featured – 900 × 430

    Portfolio – 495 × 400

    Gallery – 710 × 575

    Entry with Sidebar – 710 × 270

    Entry without Sidebar – 900 × 360

    Then I wrapped the code above in a function:

    // Add Custom sizes for Products
    function avia_change_image_size_array() {
    global $avia_config;
    $avia_config['imgSize']['product-thumb'] = array('width'=>250, 'height'=>250); // small preview pics eg sidebar news

    $avia_config['slectableImgSize'] = array(
    'product-thumb' => __('250 x 250','avia_framework'),
    );
    }
    add_action( 'init', 'avia_change_image_size_array');

    Now I only get 3 choices:

    Thumbnail – 80 × 80

    Medium – 300 × 300

    Full Size – 900 × 900

    250 x 250 – 250 × 250

    Thoughts on why the rest of the list is not appearing?

    #129951

    Hi kcharity,

    Its replacing the contents of the array so you need to add in all of them again in your child theme function.

    Regards,

    Devin

    #129952

    Ok thanks for that Devin. Would it be possible for the future to add a hook so just defined new ones are added?

    #129953

    I’ll add it as a request to our github.

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Generate new image sizes in child theme’ is closed to new replies.