Blog cá nhân
Bài viết mới nhất
Chia sẻ kinh nghiệm thực tế về WordPress, lập trình và phát triển web.
Trang 3 / 12 — 111 bài viết

Kỹ thuật debounce trong javascript – Trì hoãn nhập từ khóa trong ô input
HTML <div class=”seachbox”> <input type=”text” name=”seach-text” id=”seach-text”> </div> Javascript: function delay(callback, ms) { var timer = 0; return function () { var context = this, args = arguments; clearTimeout(timer); timer = setTimeout(function () { callback.apply(context, args); }, ms || 0); }; } $(‘#seach-text’).keyup( delay(function (e) { console.log(‘Time elapsed!’, this.value); }, 500) );

Thêm VS Code snippets
{ // Place your snippets for php here. Each snippet is defined under a snippet name and has a prefix, body and // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: // $1, $2 for tab stops, $0 for the final […]

Hướng dẫn setup docker trên local chạy WordPress
Đang cập nhật…

Import database in docker
### Import database in docker ### -i mysql mysql -u[user] -p[password] -f database_name < ten-file-sql.sql vd: user: root, pass: 123456, db: abc_db, file_Db: db.sql => sudo docker exec -i mysql mysql -uroot -p123456 -f abc_db < db.sql

Reset 1 câu lệnh trong git
### Reset 1 câu lệnh trong git ### git reset –hard commit-id git push –force origin <branch_name>

Query only seach by title
Hook only seach by title in page seach function wpse_11826_search_by_title( $search, $wp_query ) { if ( ! empty( $search ) && ! empty( $wp_query->query_vars[‘search_terms’] ) ) { global $wpdb; $q = $wp_query->query_vars; $n = ! empty( $q[‘exact’] ) ? ” : ‘%’; $search = array(); foreach ( ( array ) $q[‘search_terms’] as $term ) $search[] […]

Hướng dẫn tạo form có validate, upload file nhiều bước và xử lý ajax
B1: Đăng ký thư viện trong admin WordPress function tmdev_add_style_scripts() { $js_list_an_item_ver = date(“ymd-Gis”, filemtime( get_template_directory(). ‘/assets/js/list-an-item.js’ )); $assets_path = get_template_directory_uri(); wp_enqueue_script(‘jquery-validation’, $assets_path.’/assets/js/jquery.validate.min.js’, array(‘jquery’)); wp_enqueue_script(‘product-submit’, $assets_path.’/assets/js/list-an-item.js’, array(‘jquery’, ‘custom-script’), $js_list_an_item_ver ); wp_enqueue_style( ‘product-submit’, $assets_path.’/assets/css/product-submit.css’, ”, 123 ); } add_action( ‘wp_enqueue_scripts’, ‘tmdev_add_style_scripts’ ); B2: Tạo form và xử lý validate ở ngoài Frontend <div id=”product-submission-form”> <div class=”step-buttons”> […]

Các lỗ hổng phổ biến của WordPress và cách phòng ngừa thông qua các biện pháp thực hành tốt nhất về mã hóa an toàn
Một số lỗ hổng bảo mật liên quan đến việc hook tới các hook của admin hay lỗ hổng ko kiểm tra quyền khi upload… Common-WordPress-Vulnerabilities-and-Prevention-Through-Secure-Coding-Best-Practices Nguồn: https://www.wordfence.com/blog/2021/07/common-wordpress-vulnerabilities-and-prevention-through-secure-coding-best-practices/

Trang tổng hợp một số thư viện Javascript, Awesome JavaScript libraries
Một bộ sưu tập các thư viện, tài nguyên và so sánh giữa các thư viện JavaScript: https://js.libhunt.com/ để từ đó bạn quyết định nên chọn thư viện nào Vd: So sánh các thư viện slider:

Làm mượt Animate On Scroll Library AOS
Để custom effect animation của AOS, bạn cần điều chỉnh thẻ css sau: [data-aos][data-aos][data-aos-duration=”1000″], body[data-aos-duration=”1000″] [data-aos]{ animation-timing-function: linear(0, 0.0027, 0.0106 7.29%, 0.0425, 0.0957, 0.1701 29.16%, 0.2477, 0.3401 41.23%, 0.5982 55.18%, 0.7044 61.56%, 0.7987, 0.875 75%, 0.9297, 0.9687, 0.9922, 1) animation-duration: 1.25s; } trong đó có phần animation-timing-function bạn có thể thay thế bằng các hiệu […]