• 17-06-2015, 15:50:07
    #1
    Merhaba arkadaşlar,

    Sidebar.php içinde hata alıyorum.

    Warning: Invalid argument supplied for foreach() in /home/samsun/public_html/wp-content/themes/Temam/sidebar.php on line 27



    foreach($childItems as $childItem){
    if ($childItem->parent == $parentsItem->term_id){
    $semt[$i][$j] = $childItem;
    $j++;
    };
    };
    $i++;
    };
    }
    ?>

    27. sekme kodları bunlar, hatayı nerde aramalıyım ?
  • 17-06-2015, 17:43:38
    #2
    @KeremALTANSOY; 27. satırın birkaç satır üstünde bulunan betiği konuya ekleyebilir misiniz? Büyük bir ihtimalle $childItems değişkeni istenilen veriyi alamıyor. Yine de betiği görmemiz, sorunu anlamamız konusunda büyük bir yardımı olacağını düşünüyorum.
  • 18-06-2015, 09:22:57
    #3
    <?php
    $terms = get_terms('teslimat', 'orderby=count&hide_empty=0');
    $count = count($terms);
    if ( $count > 0 ){
    foreach ( $terms as $term ) {
    if (0 == $term->parent) $parentsItems[] = $term;
    if ($term->parent) $childItems[] = $term;
    }
    $i=0;
    foreach ($parentsItems as $parentsItem){
    $ilce[$i] = $parentsItem;
    //$semt[$i][0] = $parentsItem;
    $j=0;
    foreach ($childItems as $childItem) {

    if ($childItem->parent == $parentsItem->term_id){
    $semt[$i][$j] = $childItem;
    $j++;
    };
    };
    $i++;
    };
    }
    ?>