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…
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: // Ẩ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’)) { …
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…
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’);…
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…
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’, …
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’);…
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’, …
