I. Plugin cần thiết
Tắt javacsrip, css… không cần thiết
Disable Bloat for WordPress & WooCommerce – Speed Up & Clean Up Admin
1. Tối ưu ảnh
2. No captra Google
3. Rút gọn link Woocommerce (nếu cần)
Thêm đoạn sau vào htaccess để chuyển hướng 301 url base, nếu không sẽ bị trùng lặp nội dung
# Direct danh muc
RewriteEngine On
RewriteRule ^danh-muc-san-pham/(.*)$ /$1 [R=301,NC,L]
RewriteRule ^product/(.*)$ /$1 [R=301,NC,L]
# End Direct danh muc
4. Phân quyền user (mục đích giới hạn khách hàng không cho cài đặt plugin, chỉnh sửa theme, code web)
5. Đổi đường dẫn ảnh có dấu thành không dấu:
6. Khóa bình luận trên WordPress (không khóa dễ bị spam, treo hosting)
7. Ẩn thông báo quảng cáo wp
8. Thay đổi đường dẫn quản trị
9. Chát Facebook chính chủ
10. Clone bài viết
11. Tự động download ảnh về hosting khi coppy bài viết từ website khác
12. Chuyển bài viết thành sản phẩm và ngược lại, hoặc chuyển thành post type bất kỳ
13. Cắt lại kích thước ảnh đại diện tin tức
14. Đồng bộ dữ liệu giữa kiotviet với wp
https://wordpress.org/plugins/kiotvietsync/
15. Giới hạn kích thước tối thiểu ảnh đại diện khi up ảnh
https://wordpress.org/plugins/minimum-featured-image-size/
=> Tham khảo Hook
DevTips – How to Limit Image Size in WordPress Media Library
https://wordpress.stackexchange.com/questions/28359/how-to-require-a-minimum-image-dimension-for-uploading
16. Tối ưu database
Advanced Database Cleaner – Optimize & Clean Database to Speed Up Site Performance
17. Thêm nút gọi
https://wordpress.org/plugins/quick-call-button/
18. Tạo mục lục cho bài viết
https://babiato.net/resources/fixed-toc-table-of-contents-for-wordpress-plugin.5514/updates
19. Export / Import menu
https://wordpress.org/plugins/export-import-menus/
20. Insert Headers and Footers
WPCode – Insert Headers and Footers + Custom Code Snippets – WordPress Code Manager
21. Show hook
22. Đổi post xang product và ngược lại
23. Tích hợp nhắn tin SMS
24. Hiệu ứng khi du chuột vào sản phẩm đổi ảnh đại diện ở danh mục sản phẩm
II. Một số cài đặt khi hoàn thiện website
1. Xóa bỏ js, css mặc định của Woocommerce
[php]
/**
* Manage WooCommerce styles and scripts.
*/
function grd_woocommerce_script_cleaner() {
// Remove the generator tag
remove_action( ‘wp_head’, array( $GLOBALS[‘woocommerce’], ‘generator’ ) );
// Unless we’re in the store, remove all the cruft!
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
wp_dequeue_style( ‘woocommerce_frontend_styles’ );
wp_dequeue_style( ‘woocommerce-general’);
wp_dequeue_style( ‘woocommerce-layout’ );
wp_dequeue_style( ‘woocommerce-smallscreen’ );
wp_dequeue_style( ‘woocommerce_fancybox_styles’ );
wp_dequeue_style( ‘woocommerce_chosen_styles’ );
wp_dequeue_style( ‘woocommerce_prettyPhoto_css’ );
wp_dequeue_script( ‘selectWoo’ );
wp_deregister_script( ‘selectWoo’ );
wp_dequeue_script( ‘wc-add-payment-method’ );
wp_dequeue_script( ‘wc-lost-password’ );
wp_dequeue_script( ‘wc_price_slider’ );
wp_dequeue_script( ‘wc-single-product’ );
wp_dequeue_script( ‘wc-add-to-cart’ );
wp_dequeue_script( ‘wc-cart-fragments’ );
wp_dequeue_script( ‘wc-credit-card-form’ );
wp_dequeue_script( ‘wc-checkout’ );
wp_dequeue_script( ‘wc-add-to-cart-variation’ );
wp_dequeue_script( ‘wc-single-product’ );
wp_dequeue_script( ‘wc-cart’ );
wp_dequeue_script( ‘wc-chosen’ );
wp_dequeue_script( ‘woocommerce’ );
wp_dequeue_script( ‘prettyPhoto’ );
wp_dequeue_script( ‘prettyPhoto-init’ );
wp_dequeue_script( ‘jquery-blockui’ );
wp_dequeue_script( ‘jquery-placeholder’ );
wp_dequeue_script( ‘jquery-payment’ );
wp_dequeue_script( ‘fancybox’ );
wp_dequeue_script( ‘jqueryui’ );
}
}
add_action( ‘wp_enqueue_scripts’, ‘grd_woocommerce_script_cleaner’, 99 );
[/php]
2. Đổi sale thành % giảm giá
[php]
/**
* Đổi sale thành % giảm giá.
*/
add_filter(‘woocommerce_sale_flash’,’devvn_woocommerce_sale_flash’, 10, 3);
function devvn_woocommerce_sale_flash($text, $post, $product){
ob_start();
$sale_price = get_post_meta( $product->get_id(), ‘_price’, true);
$regular_price = get_post_meta( $product->get_id(), ‘_regular_price’, true);
if (empty($regular_price) && $product->is_type( ‘variable’ )){
$available_variations = $product->get_available_variations();
$variation_id = $available_variations[0][‘variation_id’];
$variation = new WC_Product_Variation( $variation_id );
$regular_price = $variation ->regular_price;
$sale_price = $variation ->sale_price;
}
$sale = ceil(( ($regular_price – $sale_price) / $regular_price ) * 100);
if ( !empty( $regular_price ) && !empty( $sale_price ) && $regular_price > $sale_price ) :
$R = floor((255*$sale)/100);
$G = floor((255*(100-$sale))/100);
$bg_style = ‘background:none;border: 1px solid #d42333;margin: 5px 5px 0px 0px !important;font-weight: 500 !importan’;
echo apply_filters( ‘devvn_woocommerce_sale_flash’, ‘<span class=”onsale” style=”‘. $bg_style .'”>-‘ . $sale . ‘%</span>’, $post, $product );
endif;
return ob_get_clean();
}
[/php]