Skip to content
  • HaiDM - Wordpress Developer

  • Trang chủ
  • Chia sẻ
  • Dự án Wordpress
  • Dự án ReactJS

Chia sẻ

Hiển thị bài viết liên quan cùng danh mục trong chi tiết bài viết

Hiển thị bài viết liên quan cùng danh mục trong chi tiết bài viết

calendar 12/07/2026 clock 17:12 avatar HaiDM
Dán đoạn code sau vào file single.php trong theme bạn đang sử dụng ở vị trí bạn muốn hiển thị: <?php $post_id = get_the_ID(); $cat_ids = array(); $categories = get_the_category($post_id); if ( !empty($categories) && !is_wp_error($categories) ): foreach ($categories as $category): array_push($cat_ids, $category->term_id); endforeach; endif; $current_post_type = get_post_type($post_id); $query_args = array( 'category__in' => $cat_ids, 'post_type' => […]
Xem chi tiết »
Thay đổi logo, đường dẫn trên logo và style lại trang đăng nhập admin WordPress

Thay đổi logo, đường dẫn trên logo và style lại trang đăng nhập admin WordPress

calendar 03/07/2026 clock 14:03 avatar HaiDM
Copy đoạn mã này vào file functions.php trong theme mà bạn đang sử dụng: /** * Custom login logo */ function custom_login_logo() { ?> <style type="text/css"> body, #wp-submit, #wp-submit:hover, #wp-submit:focus, #wp-submit:visited { background: #4C4C4C !important; } body a, .login form { color: #FFF !important; } body a:focus, #language-switcher input[type="submit"]:focus { box-shadow: none !important; } body […]
Xem chi tiết »
Chia sẻ code thêm “- x%” vào sau giá của Woo trong chi tiết sản phẩm

Chia sẻ code thêm “- x%” vào sau giá của Woo trong chi tiết sản phẩm

calendar 02/07/2026 clock 12:30 avatar HaiDM
Code thêm vào wp-content/themes/{your-theme}/functions.php của theme nhé add_filter('woocommerce_format_sale_price', 'add_sale_price_percentage', 20, 3 ); function add_sale_price_percentage( $price, $regular_price, $sale_price ){ // Strip html tags and currency (we keep only the float number) $regular_price = strip_tags( $regular_price ); $regular_price = (float) preg_replace('/[^0-9.]+/', '', $regular_price); $sale_price = strip_tags( $sale_price ); $sale_price = (float) preg_replace('/[^0-9.]+/', '', $sale_price); // Percentage text […]
Xem chi tiết »
Your theme does not declare WooCommerce support

Your theme does not declare WooCommerce support

calendar 02/07/2026 clock 12:04 avatar HaiDM
Khi bạn tạo theme cho woocommerce mà bị thông báo lỗi như này thì hãy thêm đoạn code sau vào theme nhé. như vậy sẽ chuyên nghiệp hơn cho theme của bạn ^^. Your theme does not declare WooCommerce support – if you encounter layout issues please read our integration guide or choose a WooCommerce […]
Xem chi tiết »
Tùy chỉnh giao diện trang search cho mỗi custom post type khác nhau

Tùy chỉnh giao diện trang search cho mỗi custom post type khác nhau

calendar 29/06/2026 clock 00:03 avatar HaiDM
1. Thêm function Thêm đoạn code sau vào file functions.php trong child theme. Thay search-product.php bằng tên file của bạn. // Custom template search function template_chooser($template) { global $wp_query; $post_type = get_query_var('post_type'); if ( isset($_GET['s']) && $post_type == 'product' ) { return locate_template('search-product.php'); } return $template; } add_filter('template_include', 'template_chooser'); 2. Tạo giao diện Như ví […]
Xem chi tiết »
Thay đổi số lượng bài viết hiển thị mỗi trang cho Custom Taxonomy

Thay đổi số lượng bài viết hiển thị mỗi trang cho Custom Taxonomy

calendar 28/06/2026 clock 23:54 avatar HaiDM
Dán đoạn code sau vào file function.php trong child theme: function custom_taxonomy_posts_per_page( $query ) { // Chỉ thay đổi ở giao diện người dùng, giao diện admin không bị ảnh hưởng if ( is_admin() || ! $query->is_main_query() ) { return; } // Thay 'YOUR_TAXONOMY_NAME' bằng slug của Custom Taxonomy mà bạn muốn thay đổi số […]
Xem chi tiết »
Hướng dẫn tạo Custom Post Type và Custom Taxonomy

Hướng dẫn tạo Custom Post Type và Custom Taxonomy

calendar 28/06/2026 clock 23:44 avatar HaiDM
Để tạo Custom Post Type (CPT) và Custom Taxonomy trong WordPress, bạn có thể dán đoạn code dưới đây vào file functions.php của theme/child-theme đang sử dụng. Dưới đây là phương pháp tạo nhanh bằng code giúp quản lý nội dung linh hoạt (ví dụ tạo loại bài viết là Sản phẩm và phân loại […]
Xem chi tiết »
Starter theme underscrores child theme

Starter theme underscrores child theme

calendar 26/06/2026 clock 21:01 avatar HaiDM
Chia sẻ theme trắng underscores + underscores child tùy biến dựa trên starter theme underscores. Child theme có tích hợp sẵn: – Bootstrap 5.3.8 – Swiper Slider 11.1.5 – Fancybox 3.5.7 – Hiệu ứng AOS 2.3.1 Một số tính năng tích hợp sẵn trong theme: – Hỗ trợ menu trượt theo khi cuộn trang. – […]
Xem chi tiết »
Cách quay lại trình soạn thảo văn bản cũ trên WordPress

Cách quay lại trình soạn thảo văn bản cũ trên WordPress

calendar 23/06/2026 clock 20:20 avatar HaiDM
Như các bạn đã biết từ khi WordPress nâng cấp lên 5.0 thì việc soạn thảo trên WordPress đã thay hoàn toàn bằng trình soạn thảo dạng khối (block) với tên gọi là Gutenberg và bỏ hoàn toàn kiểu cũ mang tên là Classic. Để dễ hình dung thì hình ảnh bên dưới đây là […]
Xem chi tiết »
  • 1
  • 2
  • right
  • contact icon
  • contact icon
to top
  • icon
  • icon
  • icon

Copyright ©2025 All rights reserved