Деление на нулевую ошибку в WordPress Theme

Недавно я купил тему WordPress, которая делает причудливую галерею отображения фотографий, и на главной странице появились следующие ошибки.

Предупреждение: Деление на ноль в /home/content/21/4913121/html/stsudios/wp-content/themes/dt-chocolate/front-gal.php в строке 36

Предупреждение: Деление на ноль в /home/content/21/4913121/html/stsudios/wp-content/themes/dt-chocolate/front-gal.php в строке 48

Ниже приведен код через строку 50 – строки с /**/ являются проблемными. Любая помощь приветствуется!

 <?php global $postgallery; $show = $postgallery->get_post_option('show'); $arr = $postgallery->get_post_option('show_'.$show); $arr = explode(",", $arr); $arr = (array)$arr; //$myterms = get_terms('dt_gallery_cat'); $myterms = apply_filters( 'taxonomy-images-get-terms', '', array('taxonomy'=> 'dt_gallery_cat')); $images = array(); global $term, $h; foreach ($myterms as $term) { if ($show == "all") { } elseif ($show == "only") { if ( !in_array( $term->term_id, $arr ) ) continue; } elseif ($show == "except") { if ( in_array( $term->term_id, $arr ) ) continue; } $term->pic = wp_get_attachment_image_src( $term->image_id, 'full' ); $k = $term->pic[1] / $term->pic[2]; /**/$term->pic = $term->pic[0];/**/ $size = taxonomy_get_size( $term->term_id ); if ($size == "s") $w = 220; if ($size == "m") $w = 460; if ($size == "l") $w = 700; /**/$h = ceil($w / $k);/**/ $term->pic = get_template_directory_uri().'/thumb.php?src='.$term->pic.'&amp;w='.$w.'&amp;h='.$h.'&amp;zc=1';