Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.85 KB | None | 0 0
  1. <?php
  2. // Slider Post Type Columns
  3. function customer_columns( $columns ) {
  4.     $columns = array(
  5.         'cb' => '<input type="checkbox" />',
  6.         'customer_name' => __( 'نام و نام خانوادگی' ),
  7.         'customer_email' => __( 'پست الکترونیکی' ),
  8.         'customer_tel' => __( 'شماره تماس' ),
  9.         'customer_website' => __( 'وب سایت' ),
  10.         'customer_type' => __( 'دسته بندی' ),
  11.         'customer_action' => __( 'عملیات' ),
  12.     );
  13.  
  14.     return $columns;
  15. }
  16. add_filter( 'manage_edit-customer_columns', 'customer_columns' ) ;
  17.  
  18. //columns content
  19. function customer_content_columns( $column,$post_id) {
  20.    
  21.     global $post;
  22.    
  23.     switch ($column){
  24.         //نام و نام خانوادگی
  25.         case 'customer_name':
  26.             echo get_post_meta($post_id,'customer_name',true);
  27.         break;
  28.        
  29.         //پست الکترونیکی
  30.         case 'customer_email':
  31.             echo get_post_meta($post_id,'customer_email',true);
  32.         break;
  33.  
  34.         //شماره تماس
  35.         case 'customer_tel':
  36.             echo get_post_meta($post_id,'customer_tel',true);
  37.         break;
  38.  
  39.         //وب سایت
  40.         case 'customer_website':
  41.             echo get_post_meta($post_id,'customer_website',true);
  42.         break;
  43.              
  44.         //دسته بندی
  45.         case 'customer_type':
  46.             $cust_type = get_post_meta($post_id,'customer_type',true);
  47.             if ($cust_type) {
  48.                 foreach ( $cust_type as $item) :
  49.                     echo $item;
  50.                 endforeach;
  51.             }
  52.         break;
  53.  
  54.         //ویرایش و حذف
  55.         case 'customer_action':
  56.             global $post;
  57.             echo '<a href="'.get_admin_url().'post.php?post='.$post_id.'&action=edit" style="margin-left:20px;">ویرایش</a>';
  58.             echo "<a href='" . wp_nonce_url( get_bloginfo('url') . "/wp-admin/post.php?post%3D" . $post->ID . "&action%3Ddelete&", 'delete-post_' . $post->ID) . "'>حذف</a>";
  59.         break;
  60.  
  61.         case 'customer_delete':
  62.         break;
  63.     }
  64.    
  65. }
  66. add_action( 'manage_posts_custom_column', 'customer_content_columns', 10, 2 );
  67.  
  68. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement