Trong bài viết này, tôi sẽ minh họa 1 cách sử dụng cách thêm trường tùy chỉnh vào biểu mẫu nhận xét trong wordpress với các ví dụ .
cách thêm trường tùy chỉnh vào biểu mẫu nhận xét trong wordpress với các ví dụ - cách thêm trường tùy chỉnh vào biểu mẫu nhận xét trong wordpress
add_filter['comment_form_default_fields','custom_fields']; function custom_fields[$fields] { $commenter = wp_get_current_commenter[]; $req = get_option[ 'require_name_email' ]; $aria_req = [ $req ? " aria-required='true'" : '' ]; $fields[ 'email' ] = ''. '' . __[ 'Email' ] . ''. [ $req ? '*' : '' ]. '
'; } // Add fields after default fields above the comment box, always visible add_action[ 'comment_form_logged_in_after', 'additional_fields' ]; add_action[ 'comment_form_after_fields', 'additional_fields' ]; function additional_fields [] { echo ' '. ''. __['Rating'] . '*