2014-10-05 3 views
-1

저는 WordPress를 사용하고 있으며 2 개의 특정 페이지에 대해 다른 페이지 로고를 갖고 싶습니다. 내가가 someting가 있지만에서 잘못 알고 ..특정 페이지의 Wordpress 로고 변경

 <?php 

     if (! function_exists('wpex_header_logo_img') && is_page(877) || ! function_exists('wpex_header_logo_img') && is_page(970)) { 
     function wpex_header_logo_img() {  

      // Get logo img from admin panel 
      $logo_img = wpex_option('custom_logo', false, 'http://amcham2.amcham.gr/wp-content/uploads/2014/09/business-branding-identity.jpg'); 

      // If logo URL isn't empty return the logo 
      if ('' != $logo_img) { 
       return $logo_img; 
      } 

      // Otherwise if logo is empty return nothing 
      else { 
       return; 
      }}}?> 

그래도 난 로고를 변경 manged했던하지 않은 :

나는 아이 테마를 만들었와 Functions.php 파일 내부에이 코드를 추가 한 뭔지 몰라.

기존 로고를 "http://amcham2.amcham.gr/wp-content/uploads/2014/09/business-branding-identity.jpg"으로 변경하고 싶습니다. 도움을 주시면 감사하겠습니다. 고맙습니다! header.php 파일의 로고 부분 (만 논리, 그 HTML 코드 누락)의 수정으로

if (! function_exists('wpex_header_logo_img')) { 
    function wpex_header_logo_img() { 



     // Get logo img from admin panel 
     $logo_img = wpex_option('custom_logo', false, 'url'); 

     // If logo URL isn't empty return the logo 
     if ('' != $logo_img) { 
      return $logo_img; 
     } 

     // Otherwise if logo is empty return nothing 
     else { 
      return; 
     } 

    } 
} 

답변

1

:

은 원래의 코드이었다 의해

if (is_page(877)) { 
    # Image for this page 
    } else if (is_page(970)) { 
    # Image for this page 
    } else { 
    # Default logo 
    } 

당신의 functions.php 파일의 원래 함수 (문제에 대한 완전한 응답) :

if (! function_exists('wpex_header_logo_img')) { 
function wpex_header_logo_img() { 

    if (is_page(877)) { 
     $logo_img = 'Image path for this page image'; 
    } else if (is_page(970)) { 
     $logo_img = 'Image path for this page image'; 
    } else { 
     // Get logo img from admin panel 
     $logo_img = wpex_option('custom_logo', false, 'url'); 
    } 

    // If logo URL isn't empty return the logo 
    if ('' != $logo_img) { 
     return $logo_img; 
    } 

    // Otherwise if logo is empty return nothing 
    else { 
     return; 
    } 
} 
} 
+0

응답을위한 Thx. 내가 header.php에서이로 변경 '경우 (! function_exists ('wpex_header_logo_img')) { \t 기능 wpex_header_logo_img() { \t \t $ logo_img = wpex_option ('custom_logo'거짓 'URL') ; \t \t 경우 (is_page (877)) { \t \t \t $ logo_img = wpex_option ('custom_logo', 진정한 'http://amcham2.amcham.gr/wp-content/uploads/2014/09/business-branding- identity.jpg '); \t \t} 다른 경우 (is_page (970)) { \t \t \t $ logo_img = wpex_option ('custom_logo', 진정한 'http://amcham2.amcham.gr/wp-content/uploads/2014/09/business -branding-identity.jpg '); \t \t \t \t \t else {return $ logo_img; \t} \t} }'행운 – Lambros

+0

다시 확인 내 응답 . 내가 요청한 기능으로 업데이트했다. 문제없이 작동해야합니다.) – c0utinh0

+0

wow thx! 그 작품! :) – Lambros

관련 문제