I recently bought a WordPress theme that does a fancy gallery display of photos and it has been getting the following errors on the homepage.
Warning: Division by zero in /home/content/21/4913121/html/stsudios/wp-content/themes/dt-chocolate/front-gal.php on line 36
Warning: Division by zero in /home/content/21/4913121/html/stsudios/wp-content/themes/dt-chocolate/front-gal.php on line 48
The following is the code through line 50 - the lines with /**/
are the trouble ones. Any help is appreciated!
<?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.'&w='.$w.'&h='.$h.'&zc=1';
If you add in some code to check that the values aren't zero it should stop it doing this, but there may be bigger problems.
and / or
These values probably shouldn't be zero though, so there is likely something else going wrong. Perhaps your images are not in a format readable by the code... or you haven't uploaded any yet