Skip to the content.
Yêu cầu
- Đối với PHP
- Học cách viết code chuẩn tại đây https://www.php-fig.org/psr/
- Luôn sử dụng 4 khoảng trống (4-spaces) khi thục dòng (indent)
- Cuối file chừa 1 dòng trống (end line)
- Đối với Javascript
- Học cách viết code chuẩn tại đây https://standardjs.com/
- Yêu cầu khác
- Viết ngay hàng thẳng lối, sạch đẹp vừa giúp bản thân dễ tìm bug vừa giúp người khác dễ tiếp cận. Xin hãy vì mọi người xin cảm ơn.
Đặt tên
- Thêm tiếp đầu ngữ (prefix là cba) ở các function để tránh trùng lặp ví dụ cba_sendmail()
- Nối các từ trong tên thư mục bằng dấu gạch nối ví dụ: template-parts
- Nối các từ trong tên tập tin cũng bằng dấu gạch nối ví dụ archive-post-type.php
- Trong inc nên đặt tên file theo {Chức năng/Kiểu loại}-{Ý nghĩa}.php
- Thư mục template-pages các tên file được đặt theo cách page-slug.php với slug nên đặt theo url của trang ví dụ trang https://themestandard.com/recruit/search/shop/ thì slug nên đặt là recruit-search-shop và file sẽ là page-recruit-search-shop.php
- Tên biến PHP chữ thường, ký tự latin, không dấu, không đặc biệt. Ví dụ: $ten_bien
- Sử dụng các từ tiếng anh, ngắn gọn, dễ hiểu
Navigation