久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      詳解wordpress怎么添加自定義按鈕并導(dǎo)出csv

      下面由WordPress教程欄目給大家介紹wordpress后臺(tái)怎么添加自定義按鈕并導(dǎo)出csv,希望對(duì)需要的朋友有所幫助!

      詳解wordpress怎么添加自定義按鈕并導(dǎo)出csv

      wordpress 后臺(tái)添加自定義按鈕導(dǎo)出csv

      在wp-admin/edit.php中找到如下代碼:

      <?php if ( current_user_can( $post_type_object->cap->create_posts ) ) {     echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; }

      在上面代碼的下一行加入如下代碼:

      if ($post_type == 'aaa') {     echo ' <a href="'.esc_url( admin_url('admin-ajax.php?action=export_permanent_csv')).'" class="page-title-action">CSVをエクスポート</a>'; }

      $post_type 是在這個(gè)文件的頭部獲取的文章的類型。
      在wp-content/themes/hcr/functions/admin.php

      function export_permanent_csv() {     $args = array(             'post_type' => 'aaa',             'numberposts' => -1,             'meta_key' => 'mark_id',             'orderby' => 'meta_value_num',             'order' => 'ASC',             );     $posts = get_posts($args);     if (empty($posts)) {         return;     }     $noNumber = 1;     foreach ($posts as $post) {         $metaData = get_post_meta($post->ID);         $data = [             $metaData['mark_id'][0],             $noNumber,             $post->post_title,             $metaData['prmnnt_address'][0],             $metaData['prmnnt_tel'][0],             $metaData['prmnnt_fax'][0],             $metaData['prmnnt_site'][0],             $metaData['prmnnt_time'][0],             $metaData['prmnnt_closing'][0],             $metaData['prmnnt_service'][0],             $metaData['prmnnt_class'][0],             $post->post_type,         ];         $csv_output .= '"'.implode('","', $data).'"'."n";         $noNumber++;     }     $csv_output .= "n";     $filename = $file."_".date("Ymd", time());     header("Content-type: application/vnd.ms-excel");     header("Content-disposition: csv" . date("Y-m-d") . ".csv");     header("Content-disposition: filename=".$filename.".csv");     print $csv_output;     exit;  } add_action('wp_ajax_export_permanent_csv', 'export_permanent_csv');

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)