Code hiển thị ngày đăng ký của thành viên trong WordPress

banner home FINAL 1050x121 1
huong dan su dung wordpress 2

Code hiển thị ngày đăng ký của thành viên trong WordPress

Sau khi xem hình ảnh đại diện của bài viết thì bạn đã hiểu rõ code này để làm gì rồi phải không nào?
Thì đây là code có chức năng thêm một trường ngày tham gia (ngày đăng ký của thành viên) vào trình quản lý thành viên trong WordPress.

Code hiển thị ngày đăng ký của thành viên

Các bạn sao chép đoạn code ở bên dưới và dán vào file functions.php nằm trong thưc mục theme mà bạn đang sử dụng.

// them truong xem ngay dang ky vao trinh quan ly admin wordpress
add_filter( 'manage_users_columns', 'rudr_modify_user_table' );
function rudr_modify_user_table( $columns ) {
$columns['registration_date'] = 'Ngày tham gia';
return $columns;
}
add_filter( 'manage_users_custom_column', 'rudr_modify_user_table_row', 10, 3 );
function rudr_modify_user_table_row( $row_output, $column_id_attr, $user ) {
$date_format = 'd/m/Y';
switch ( $column_id_attr ) {
case 'registration_date' :
return date( $date_format, strtotime( get_the_author_meta( 'registered', $user ) ) );
break;
default:
}
return $row_output;
}
add_filter( 'manage_users_sortable_columns', 'rudr_make_registered_column_sortable' );
function rudr_make_registered_column_sortable( $columns ) {
return wp_parse_args( array( 'registration_date' => 'registered' ), $columns );
}
// ket thuc

Sau khi hoàn tất thì bạn hãy truy cập vào Trình quản lý admin > Thành viên và xem kết quả nhé.
AZ9S Chúc bạn thành công!

0/5 (0 Reviews)

Theo dõi và cập nhật tin tức AZ9s thông qua các kênh truyền thông:

- Zalo Channel

- Facebook Channel

- Youtube Channel

banner home FINAL 1050x121 1
0 0 votes
Article Rating
Nhận thông báo qua Email
Nhận thông báo cho
guest

0 Comments
Inline Feedbacks
View all comments
0
Hãy để lại bình luận của bạn!x
()
x