2016-04-14 19 views
0

Wordpress'te özel bir meta kutusu oluşturdum, ancak içeriğimin sonunda bir "1" var. Nasıl kaldırılacağını anlayamıyorum. Bu çağrıyla WordPress'te bir meta kutusunun sonuna eklenen rakam nasıl kaldırılır?

...

add_meta_box(2, 'Calendrier de la formation', 'render_formations_calendrier_meta_box', null, 'side'); 

Bu METABOX olsun.

enter image description here

bu "1" nedir? Ve onu çıkarabilir miyim? "1

<table id="new_date_area"> 
    <?php $dates = get_post_meta($post->ID, 'next_date') ?> 
    <?php foreach($dates as $key => $date) : ?> 
     <?php foreach($date as $event) : ?> 
     <tr> 
      <td style="padding:10px 0 0 0"> 
       <input type="text" name="next_date[]" class="datepicker" value="<?= date('d-m-Y', $event) ?>"><span class="dashicons dashicons-trash"></span> 
      </td> 
     </tr> 
     <?php endforeach; ?> 
    <?php endforeach; ?> 
</table> 
<button id="new_date_button">nouvelle date</button> 
<script> 
    $(document).ready(function(){ 
     // datepicker 
     var format = 'dd-mm-yy' 
     $('.datepicker').datepicker({ 
      dateFormat : format 
     }) 

     // new date 
     $('#new_date_button').on('click', (click_event) => { 
      click_event.preventDefault() 
      var row = '<tr><td><input type="text" name="next_date[]" class="datepicker"><span class="dashicons dashicons-trash"></span></td></tr>' 
      $('#new_date_area').append(row) 
      $('.datepicker').datepicker({ 
       dateFormat : format 
      }) 
     }) 

     // delete date 
     $(document).on('click', '.dashicons-trash', function(e) { 
      $(e.target).closest('tr').remove() 
     }) 
    }) 
</script> 
+0

Sorun, render_formations_calendrier_meta_box – Mihai

+0

Gerçekten de işlevinde olabilir, lütfen render_formations_calendrier_meta_box() işlevinin kodunu ekleyin. –

+0

@NerijusMasikons Sadece bir html dosyası gerektirir: fonksiyon render_formations_calendrier_meta_box ($ post) { yankı gerektirir ('şablonlar/Partials/admin/oluşumlar/calendrier_metabox.php'); } – RFlavien

cevap

0

ben onu çözdüm:

düzenlemek

function render_formations_calendrier_meta_box($post) { 
    echo require('templates/partials/admin/formations/calendrier_metabox.php'); 
} 

şablonları/Partials/admin/oluşumları/calendrier_metabox.php (benim şablondan gelmedi) "function require() işlevinin geri dönüşüydü. Echo required() yapıyordum ama sadece eko olmadan bir ihtiyaç yapmak zorundayım.

İlgili konular