Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Slider Post Type Columns
- function customer_columns( $columns ) {
- $columns = array(
- 'cb' => '<input type="checkbox" />',
- 'customer_name' => __( 'نام و نام خانوادگی' ),
- 'customer_email' => __( 'پست الکترونیکی' ),
- 'customer_tel' => __( 'شماره تماس' ),
- 'customer_website' => __( 'وب سایت' ),
- 'customer_type' => __( 'دسته بندی' ),
- 'customer_action' => __( 'عملیات' ),
- );
- return $columns;
- }
- add_filter( 'manage_edit-customer_columns', 'customer_columns' ) ;
- //columns content
- function customer_content_columns( $column,$post_id) {
- global $post;
- switch ($column){
- //نام و نام خانوادگی
- case 'customer_name':
- echo get_post_meta($post_id,'customer_name',true);
- break;
- //پست الکترونیکی
- case 'customer_email':
- echo get_post_meta($post_id,'customer_email',true);
- break;
- //شماره تماس
- case 'customer_tel':
- echo get_post_meta($post_id,'customer_tel',true);
- break;
- //وب سایت
- case 'customer_website':
- echo get_post_meta($post_id,'customer_website',true);
- break;
- //دسته بندی
- case 'customer_type':
- $cust_type = get_post_meta($post_id,'customer_type',true);
- if ($cust_type) {
- foreach ( $cust_type as $item) :
- echo $item;
- endforeach;
- }
- break;
- //ویرایش و حذف
- case 'customer_action':
- global $post;
- echo '<a href="'.get_admin_url().'post.php?post='.$post_id.'&action=edit" style="margin-left:20px;">ویرایش</a>';
- echo "<a href='" . wp_nonce_url( get_bloginfo('url') . "/wp-admin/post.php?post%3D" . $post->ID . "&action%3Ddelete&", 'delete-post_' . $post->ID) . "'>حذف</a>";
- break;
- case 'customer_delete':
- break;
- }
- }
- add_action( 'manage_posts_custom_column', 'customer_content_columns', 10, 2 );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement