Wednesday, June 27, 2018

php - Division by zero error in WordPress Theme

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!




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';

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...