2011-08-17 6 views
-1

에서 헤더 오류가 발생의 functions.php 파일으로 출력한다 나쁜 헤더 오류 오메 :functions.php 내가 내 워드 프레스 테마에 문제가 워드 프레스

Warning: Cannot modify header information - headers already sent by (output started at /home/slavisap/public_html/femarkets/wordpress/wp-content/themes/Flex E/functions.php:67) in /home/slavisap/public_html/femarkets/wordpress/wp-includes/pluggable.php on line 934

내가 어떤 페이지를 방문하려고 할 때 또는 그것은 무작위로 발생 관리자에게서 다른 것을 만드십시오.

이 내 functions.php입니다 :

<?php 
if (function_exists('register_nav_menus')) { 
    register_nav_menus(
      array(
       'primary' => 'Primary Header Nav', 
       'footer_menu' => 'Footer Menu', 
       'exploring' => 'Exploring Page Menu', 
       'using' => 'Using Page Menu', 
       'downloading' => 'Downloading Page Menu' 
      ) 
    ); 
} 
function get_breadcrumbs() { 
    global $wp_query; 

    if (!is_home()) { 

     // Start the UL 
     echo '<ul class="breadcrumbs">'; 
     // Add the Home link 
     echo '<li><a href="' . get_settings('home') . '">' . get_bloginfo('name') . '</a></li>'; 

     if (is_category()) { 
      $catTitle = single_cat_title("", false); 
      $cat = get_cat_ID($catTitle); 
      echo "<li> &#47; " . get_category_parents($cat, TRUE, " &#47; ") . "</li>"; 
     } elseif (is_archive() && !is_category()) { 
      echo "<li> &#47; Archives</li>"; 
     } elseif (is_search()) { 

      echo "<li> &#47; Search Results</li>"; 
     } elseif (is_404()) { 
      echo "<li> &#47; 404 Not Found</li>"; 
     } elseif (is_single()) { 
      $category = get_the_category(); 
      $category_id = get_cat_ID($category[0]->cat_name); 

      echo '<li> &#47; ' . get_category_parents($category_id, TRUE, " &#47; "); 
      echo the_title('', '', FALSE) . "</li>"; 
     } elseif (is_page()) { 
      $post = $wp_query->get_queried_object(); 

      if ($post->post_parent == 0) { 

       echo "<li> &#47; " . the_title('', '', FALSE) . "</li>"; 
      } else { 
       $title = the_title('', '', FALSE); 
       $ancestors = array_reverse(get_post_ancestors($post->ID)); 
       array_push($ancestors, $post->ID); 

       foreach ($ancestors as $ancestor) { 
        if ($ancestor != end($ancestors)) { 
         echo '<li> &raquo; <a href="' . get_permalink($ancestor) . '">' . strip_tags(apply_filters('single_post_title', get_the_title($ancestor))) . '</a></li>'; 
        } else { 
         echo '<li> &raquo; ' . strip_tags(apply_filters('single_post_title', get_the_title($ancestor))) . '</li>'; 
        } 
       } 
      } 
     } 

     // End the UL 
     echo "</ul>"; 
    } 
} 
?> 

내 웹 사이트 URL : http://slavisaperisic.com/femarkets/wordpress/

당신은 내가 잘못 무엇을 알 수 있습니까?

+2

글쎄, 무엇을'/ 집/slavisap/public_html/femarkets/wordpress/wp-content/themes/Flex E/functions.php는 67 행에 있습니까? –

답변

6

게시 한 functions.php 파일에는 67 행이 없으므로 (최소한 편집자에게 복사/붙여 넣기 한 버전) 처음에는 공백이 있거나 공백이있는 것으로 생각됩니다. functions.php 파일의 끝 (시작하기 전에 <?php 또는 닫는 ?> 태그 뒤에).

<?php ?> 태그 외부의 PHP 파일에있는 모든 문자는 표준 출력으로 처리되고 STDOUT (또는 웹 서버 출력 스트림)에 즉시 기록되며 웹 서버 시나리오에서는 헤더가 전송됩니다. 응답의 본문이 출력됩니다.

열기 <이 파일의 첫 번째 문자이고 닫음 >이 파일의 마지막 문자인지 확인하십시오.

당신은 실제로이 같은 문제를 방지하는 데 도움이 될 것 생략 파일의 모든 데이터는 PHP 코드의 경우 닫는 ?> 태그를 포함해야하고,하지 않습니다 ...

+0

나는 여분의 공백을 가지고있다. 나는 그것을 제거하고 그것이 나를 도울 것인지 알려준다. –

+0

고맙다. –

+1

No probs - 나는'include()'될 파일에서 닫는 태그를 생략하는 것이 좋습니다. – DaveRandom