Mở file functions.php trong child theme của bạn (nếu chưa có child theme, bạn nên tạo child theme để tránh mất thay đổi khi update theme). Thêm đoạn code sau: // Thêm nút phản ánh dưới mỗi bài post/page function add_feedback_button($content) { if (is_single() || is_page()) { $content .= ‘<button id=”open-feedback-form” class=”feedback-btn”>Phản ánh bài viết</button>’;…
Lưu trữ danh mục: Code function
Mở file functions.php trong child theme của bạn (nếu chưa có child theme, bạn nên tạo child theme để tránh mất thay đổi khi update theme). Thêm đoạn code sau: //thông báo giờ đóng cửa add_action(‘wp_footer’, ‘webdy_store_hours_flatsome’); function webdy_store_hours_flatsome() { // Thiết lập múi giờ Việt Nam (UTC+7) date_default_timezone_set(‘Asia/Ho_Chi_Minh’);…
Mở file functions.php trong child theme của bạn (nếu chưa có child theme, bạn nên tạo child theme để tránh mất thay đổi khi update theme). Thêm đoạn code sau: //Chia sẻ bài viết lên mạng xã hội function custom_social_share_buttons($content) { if (is_single() || is_page()) { $url = urlencode(get_permalink()); $title = urlencode(get_the_title()); $facebook =…
Mở file functions.php trong child theme của bạn (nếu chưa có child theme, bạn nên tạo child theme để tránh mất thay đổi khi update theme). Thêm đoạn code sau: // Hàm lấy số lượng Like hoặc Dislike function ip_get_like_count($type = ‘likes’) { $current_count = get_post_meta(get_the_id(), $type, true); return ($current_count ?…
Mở file functions.php trong child theme của bạn (nếu chưa có child theme, bạn nên tạo child theme để tránh mất thay đổi khi update theme). Thêm đoạn code sau: // chặn bình luận chứa liên kết function webdy_block_links_in_comments($comment_content) { $pattern = ‘/\b(?:https?|ftp):\/\/[^\s]+/i’; if (preg_match($pattern, $comment_content)) { wp_die(__(‘Bình luận của bạn đã bị chặn bởi Webdy….
Thêm đoạn code sau vào file functions.php: function wpvn_no_meta_viewport() { return false; } add_filter( ‘flatsome_viewport_meta’, ‘wpvn_no_meta_viewport’ );
Thêm đoạn code sau vào functions.php // Xóa /category/ khỏi URL function remove_category_base($string, $term) { if ($term->taxonomy == ‘category’) { $string = str_replace(‘/category/’, ‘/’, $string); } return $string; } add_filter(‘term_link’, ‘remove_category_base’, 10, 2); // Thêm rewrite rules để tránh lỗi 404 function add_category_rewrite_rules($wp_rewrite) { …
Dán code sau vào function.php // Hook vào quản trị để thêm cột ID vào danh sách bài viết add_filter(‘manage_posts_columns’, ‘add_post_id_column’); add_action(‘manage_posts_custom_column’, ‘show_post_id_column’, 10, 2); // Thêm cột ID vào danh sách cột function add_post_id_column($columns) { $columns = array_slice($columns, 0, 1, true) + [‘post_id’ => ‘ID’] + array_slice($columns, 1, null, true); …
Tại sao URL có chứa chuỗi ?srsltid ? Chuỗi ?srsltid xuất hiện trong URL do Google Merchant Center thêm vào các liên kết trong kết quả tìm kiếm mua sắm tự nhiên (ví dụ: www.domain.com?srsltid=123xyz). Mặc dù chuỗi này không ảnh hưởng đến SEO, nhưng nó có thể gây mất thẩm mỹ cho đường link….
Dán code sau vào function.php //ba thao tác chính nhằm tăng cường bảo mật và hiệu suất của trang WordPress add_filter(‘xmlrpc_enabled’, ‘__return_false’); add_filter(‘wp_headers’, ‘webdy_remove_x_pingback’); add_filter(‘pings_open’, ‘__return_false’, 9999); function webdy_remove_x_pingback($headers) { unset($headers[‘X-Pingback’], $headers[‘x-pingback’]); return $headers; } Những thao tác này giúp giảm bớt các nguy cơ bảo mật tiềm ẩn và…
