Lưu trữ danh mục: Kiến thức Wordpress

Thêm Font Awesome

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:   function add_fontawesome_icons() { wp_enqueue_style( ‘font-awesome’, ‘https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css’ ); } add_action( ‘wp_enqueue_scripts’, ‘add_fontawesome_icons’ );  

Hiện số điện thoại khi hết hàng

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: add_filter( ‘woocommerce_get_availability’, ‘webdy_custom_out_of_stock’, 1, 2 ); function webdy_custom_out_of_stock( $availability, $_product ) { if ( ! $_product->is_in_stock() ) { // Hotline button HTML $hotline = ‘<a…

Ẩn UX Builder và chặn truy cập trực tiếp nếu không phải Admin

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: // Ẩn UX Builder và chặn truy cập trực tiếp nếu không phải Admin function webdy_hide_ux_builder_for_non_admins() {     if (!current_user_can(‘administrator’)) {      …

Hướng dẫn tích hợp Google Translate vào website

Chép code sau vào HTML2 <a href=”#” onclick=”doGTranslate(‘vi|en’);return false;” title=”English” class=”glink nturl notranslate”><img src=”/wp-content/plugins/gtranslate/flags/24/en.png” height=”24″ width=”24″ alt=”English” /> <span>EN</span></a> <a href=”#” onclick=”doGTranslate(‘vi|vi’);return false;” title=”Vietnamese” class=”glink nturl notranslate”><img src=”/wp-content/plugins/gtranslate/flags/24/vi.png” height=”24″ width=”24″ alt=”Vietnamese” /> <span>VI</span></a> <style>#goog-gt-tt{display:none!important;}.goog-te-banner-frame{display:none!important;}.goog-te-menu-value:hover{text-decoration:none!important;}.goog-text-highlight{background-color:transparent!important;box-shadow:none!important;}body{top:0!important;}#google_translate_element2{display:none!important;}</style> <div id=”google_translate_element2″></div> <script>function googleTranslateElementInit2() {new google.translate.TranslateElement({pageLanguage: ‘vi’,autoDisplay: false}, ‘google_translate_element2’);}if(!window.gt_translate_script){window.gt_translate_script=document.createElement(‘script’);gt_translate_script.src=’https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit2′;document.body.appendChild(gt_translate_script);}</script> <script> function GTranslateGetCurrentLang() {var keyValue = document[‘cookie’].match(‘(^|;) ?googtrans=([^;]*)(;|$)’);return…

Hướng dẫn thêm khung quảng cáo sau mỗi bài viết

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:   // Đăng ký metabox quảng cáo function webdy_ads_metabox() { add_meta_box( ‘webdy_ads_metabox’, ‘Quảng Cáo Dịch Vụ’, ‘webdy_render_ads_metabox’, [‘post’, ‘page’], ‘normal’, ‘default’ ); } add_action(‘add_meta_boxes’, ‘webdy_ads_metabox’);…

Loại bỏ các trường không cần thiết từ trang checkout WooCommerce

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 để thay đổi giao diện và chức năng của trang checkout trong WooCommerce: //—— add_filter(‘woocommerce_checkout_fields’, ‘custom_modify_checkout_fields’, 999999); function custom_modify_checkout_fields($fields) { // Xóa bỏ các trường…

Hướng dẫn thêm các liên kết sau mỗi bài viết

  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 link sau bài viết*/ // Đăng ký metabox function custom_links_metabox() {     add_meta_box(         ‘custom_links_metabox’,      …

Hướng dẫn thêm cột “Views” vào danh sách bài viết trong Dashboard

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 cột “Views” vào danh sách bài viết trong Dashboard add_filter(‘manage_posts_columns’, ‘posts_column_views’); add_action(‘manage_posts_custom_column’, ‘posts_custom_column_views’, 5, 2); function posts_column_views($defaults){     $defaults[‘post_views’] = __(‘Views’);…

Hướng dẫn code function Tạo mật khẩu (password) cho bài viết (post) để xem tiếp

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: //đặt pass cho post // Thêm meta box nhập mật khẩu function add_password_meta_box() {     add_meta_box(         ‘custom_password_meta’,      …

💬
Trợ lý Webdy
Chatbot được phát triển bởi Webdy.vn