hamworks / simple-csv-exporter
2.1.0
2022-07-27 02:52 UTC
Requires
- php: >=7.4
- php-di/php-di: ^6.3
Requires (Dev)
This package is auto-updated.
Last update: 2024-08-27 07:18:13 UTC
README
贡献者:Toro_Unit,hamworks
捐赠链接: https://www.paypal.me/torounit
标签:CSV,export
至少需要:5.8
测试到:6.0
需要PHP:7.4
稳定标签:2.1.0 许可证:GPLv2 或更新
许可证URI: https://gnu.ac.cn/licenses/gpl-2.0.html
Simple CSV Exporter.
描述
Simple CSV Exporter. 导出的CSV可以与Really Simple CSV Importer一起导入。
当你选择文章类型时,文章将被导出。
Github仓库: https://github.com/hamworks/simple-csv-exporter
自定义要导出的数据
自定义列。
use HAMWORKS\WP\Simple_CSV_Exporter\Data_Builder; add_action( 'simple_csv_exporter_created_data_builder', function ( Data_Builder $data ) { // Remove column. $data->append_drop_column( 'page_template' ); // Add custom field column. $data->append_meta_key( 'my_meta_key' ); } );
自定义要导出的文章。
add_action( 'simple_csv_exporter_data_builder_for_wp_posts_pre_get_posts', function ( WP_Query $query ) { $query->set( 'order', 'ASC' ); } );
元数据数据过滤器。
add_filter( 'simple_csv_exporter_data_builder_for_wp_posts_get_post_meta_fields', function ( array $fields ) { foreach ( array( 'your_flag', ) as $key ) { if ( isset( $fields[ $key ] ) ) { $fields[ $key ] = ! empty( $fields[ $key ] ) ? 'TRUE' : 'FALSE'; } } return $fields; } );
文章数据过滤器。
add_filter( 'simple_csv_exporter_data_builder_for_wp_posts_row_data', function ( $row_data, $post ) { $row_data['permalink'] = get_permalink( $post ); unset( $row_data['comment_status'] ); return $row_data; }, 10, 2 );
变更日志
2.1.0
- 重命名钩子。
- 添加
simple_csv_exporter_data_builder_for_wp_posts_row_data
过滤器。
2.0.1
- 在WP 6.0上测试
- 停止支持WP 5.7 和 PHP 7.3
2.0.0
- 使用PHP-DI。
- 重构。
1.1.0
- 重构版本。
1.0.0
- 第一个版本。
0.0.1
- 内部版本。