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’);…
Lưu trữ danh mục: Kiến thức Wordpress
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 =…
Bạn có thể thiết lập thông báo Telegram khi có ai đó sửa đổi hoặc thêm tệp trong thư mục WordPress bằng cách sử dụng một script PHP kết hợp với webhook của Telegram và inotifywait (trên Linux). Cách thực hiện: Tạo bot Telegram và lấy token Vào @BotFather trên Telegram. Gõ lệnh /newbot và…
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….
Web code tay và web dùng WordPress (WP) là hai cách tiếp cận khác nhau để xây dựng một trang web. Dưới đây là sự phân biệt chi tiết: 1. Định nghĩa Web code tay: Là trang web được viết hoàn toàn bằng mã nguồn (HTML, CSS, JavaScript, PHP, Python, hoặc ngôn ngữ lập trình…
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 <div class=”theme-newyear”> <img src=”//webdy.vn/public/files/uploads/2024/03/motorbike.png” width=”70″ height=”58″ class=”motorbike”> </div> <style> .theme-newyear .motorbike { left: calc(100% – 80px); max-width: 70px; position: absolute; top: -55px; transform: scaleX(1); animation: motorbikeAnimation 24s infinite ease-in-out; }@keyframes motorbikeAnimation{ 0% { left: 0; transform: scaleX(1);…
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….
