2012-12-06 2 views
0

내 function.php를 편집 할 때 어떤 이유로 인해 여러 페이지가 흰색으로 변합니다. 이 코드 exmaple, 경우 :functions.php WordPress의 화이트 페이지를 야기합니다.

<?php 
    /* Add a custom field to the field editor (See editor screenshot) */ 
    add_action("gform_field_standard_settings", "my_standard_settings", 10, 2); 
    function my_standard_settings($position, $form_id){ 
     // Create settings on position 25 (right after Field Label) 
     if($position == 25){ 
?> 
      <li class="admin_label_setting field_setting" style="display: list-item; "> 
       <label for="field_placeholder">Placeholder Text 
        <!-- Tooltip to help users understand what this field does --> 
        <a href="javascript:void(0);" class="tooltip tooltip_form_field_placeholder" tooltip="&lt;h6&gt;Placeholder&lt;/h6&gt;Enter the placeholder/default text for this field.">(?)</a> 
       </label> 
       <input type="text" id="field_placeholder" class="fieldwidth-3" size="35" onkeyup="SetFieldProperty('placeholder', this.value);"> 
      </li> 
<?php 
     } 
    } 
    /* Now we execute some javascript technicalitites for the field to load correctly */ 
    add_action("gform_editor_js", "my_gform_editor_js"); 
    function my_gform_editor_js(){ 
?> 
     <script> 
      //binding to the load field settings event to initialize the checkbox 
      $(document).bind("gform_load_field_settings", function(event, field, form){ 
       $("#field_placeholder").val(field["placeholder"]); 
      }); 
     </script> 

<?php 
    } 
    /* We use jQuery to read the placeholder value and inject it to its field */ 
    add_action('gform_enqueue_scripts',"my_gform_enqueue_scripts", 10, 2); 
    function my_gform_enqueue_scripts($form, $is_ajax=false){ 
?> 
     <script> 
      jQuery(function(){ 
       <?php 
        /* Go through each one of the form fields */ 
        foreach($form['fields'] as $i=>$field){ 
         /* Check if the field has an assigned placeholder */ 
         if(isset($field['placeholder']) && !empty($field['placeholder'])){ 
          /* If a placeholder text exists, inject it as a new property to the field using jQuery */ 
       ?> 
       jQuery('#input_<?php echo $form['id']?>_<?php echo $field['id']?>').attr('placeholder','<?php echo $field['placeholder']?>'); 
       <?php 
         } 
        } 
       ?> 
      }); 
     </script> 
<?php 
    } 
?> 

업데이트 페이지 (: /wp-admin/post.php URL에서) 빈 페이지에 나를 떠난다. 코드의 또 다른 조각 나는이 튜토리얼에서 사용하려고 시도했다 :

http://www.doitwithwp.com/pre-populate-fields-using-gravity-forms/

페이지의 로그에서 빈, 화이트 페이지를하도록합니다. WordPress의 최신 버전을 실행 중입니다. 왜 이런 일이 일어날까요?

+1

오류보고가없고 첫 번째

답변

2

시작 PHP 태그 앞에 공백을 제거하십시오. 때때로 이것은 큰 문제를 일으 킵니다. 일반적으로이 파일은 나중에 사용하기위한 기능 만 포함하고 내용을 제공하지 않으므로 아무 것도 울리지 않습니다.

+0

불필요한 공백을 모두 제거했습니다. 이상하다. – JacobTheDev

+0

내용이 생성되기 직전에 일부 헤더를 보내는 시스템이 이상하지 않은 경우가 있습니다. 따라서 문자열을 보내면 헤더가 실패하고 나머지 코드가 충돌 할 수 있습니다 ... – Djumaka

+0

나는 여전히 이상하다고 생각합니다. 그것이 적응할만큼 똑똑 할 수 있다고 생각합니다. 정말로 내가 사용하는 유일한 "코딩"언어는 JavaScript/jQuery/HTML/CSS입니다. 이러한 언어에서 공백은 중요하지 않으며 PHP로 왜 중요한지 알지 못합니다. 그 langs에 – JacobTheDev

관련 문제