2011-07-12 12 views
0

我最近買了一個WordPress主題,做了一個花哨的畫廊顯示的照片,它已經在主頁上得到以下錯誤。在WordPress主題中由零錯誤劃分

警告:在/home/content/21/4913121/html/stsudios/wp-content/themes/dt-chocolate/front-gal.php被零除在線路36上

警告:被零除在線48上的/home/content/21/4913121/html/stsudios/wp-content/themes/dt-chocolate/front-gal.php

以下是通過第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'; 
+0

要求退款。 WordPress的主題花錢?! –

+0

預設'$ w'爲預設的「預設」大小,因爲如果未設定「$ size」,則不會設定「$ w」造成部分問題。 – stealthyninja

+1

Themeforest主題很可怕:「將CHMOD 777設置爲文件夾」your_site/wp-content/themes/dt-chocolate/cache「2)必須創建文件夾」your_site/wp-content/uploads「,並將CHMOD設置爲777」是的,對。你好,黑客,請破解我。 – markratledge

回答

2

如果你添加一些代碼來檢查值是否爲零,它應該停止它這樣做,但可能會有更大的問題。

if ($term->pic[1] == 0 || $term->pic[2] == 0) return 

和/或

$h = ($w > 0 && $k > 0) ? ceil($w/$k) : 0; 

這些值可能不應該是零了,所以有可能是別的事情錯了。也許你的圖像沒有可以被代碼讀取的格式...或者你還沒有上傳

+0

謝謝伊恩。我認爲同樣的事情,但在添加圖像後,該網站可以正常工作,但在圖像加載時仍會首先顯示錯誤消息。將嘗試此添加。 –

+0

這樣做的竅門!謝謝伊恩! –

+0

請記住接受他的回答! – mrtsherman