0

I know that it may sound silly but after I read functions.php file in TwentySixteen WordPress Theme, I found this strange syntax I have never seen before. Please check this following code.

function twentysixteen_content_image_sizes_attr( $sizes, $size ) {
    $width = $size[0];

    840 <= $width && $sizes = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px';

    if ( 'page' === get_post_type() ) {
        840 > $width && $sizes = '(max-width: ' . $width . 'px) 85vw, ' . $width . 'px';
    } else {
        840 > $width && 600 <= $width && $sizes = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px';
        600 > $width && $sizes = '(max-width: ' . $width . 'px) 85vw, ' . $width . 'px';
    }

    return $sizes;
}
add_filter( 'wp_calculate_image_sizes', 'twentysixteen_content_image_sizes_attr', 10 , 2 );

This is the line of code confusing me...

840 <= $width && $sizes = '(max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px';

I have already done some researches, but could not find any resources mention the use of double ampersand in this situation. what I found is just the use of double ampersand in condition like if/else or things like that.

Could you please explain what that line of code means or please give me some links to the resource. I will follow the links and read it.

P.S. I'm so sorry for my poor English. Because I'm not native English speaker, I don't know what keywords should I use to google it, that's why I ask such stupid question like this.

Thanks in advance.

0 Answers0