Category

Wordpress

44 articles in this category

Xóa bỏ css js mặc định của Woocommerce

29 Tháng 10, 2018 1 min read

[php] function grd_woocommerce_script_cleaner() { remove_action( ‘wp_head’, array( $GLOBALS[‘woocommerce’], ‘generator’ ) ); if ( ! is_admin()) { wp_dequeue_style( ‘woocommerce_frontend_styles’ ); wp_dequeue_style( ‘woocommerce-general’); wp_dequeue_style( ‘woocommerce-layout’ ); wp_dequeue_style( ‘woocommerce-smallscreen’ ); wp_dequeue_style(…

xóa bỏ fields billing wooocommerce

29 Tháng 10, 2018 1 min read

[php] add_filter( ‘woocommerce_checkout_fields’ , ‘custom_override_checkout_fields’ ); function custom_override_checkout_fields( $fields ) { unset($fields[‘billing’][‘billing_first_name’]); unset($fields[‘billing’][‘billing_last_name’]); unset($fields[‘billing’][‘billing_company’]); unset($fields[‘billing’][‘billing_address_1’]); unset($fields[‘billing’][‘billing_address_2’]); unset($fields[‘billing’][‘billing_city’]); unset($fields[‘billing’][‘billing_postcode’]); unset($fields[‘billing’][‘billing_country’]); unset($fields[‘billing’][‘billing_state’]); unset($fields[‘billing’][‘billing_phone’]); unset($fields[‘order’][‘order_comments’]); unset($fields[‘billing’][‘billing_address_2’]); unset($fields[‘billing’][‘billing_postcode’]); unset($fields[‘billing’][‘billing_company’]); unset($fields[‘billing’][‘billing_last_name’]); unset($fields[‘billing’][‘billing_email’]); unset($fields[‘billing’][‘billing_city’]);…

lấy tên menu qua menu locations

29 Tháng 10, 2018 1 min read

[php] $menu_name = ‘Footer_Menu1’ //tên menulocations; $locations = get_nav_menu_locations(); $menu_id = $locations[ $menu_name ] ; print_r(wp_get_nav_menu_object($menu_id)->name [/php]

Tạo mutiplete select category

29 Tháng 10, 2018 1 min read

[php] add_filter( ‘wp_dropdown_cats’, ‘wp_dropdown_cats_multiple’, 10, 2 ); function wp_dropdown_cats_multiple( $output, $r ) { if( isset( $r[‘multiple’] ) && $r[‘multiple’] ) { $output = preg_replace( ‘/^

Wordpres Bảo trì website

29 Tháng 10, 2018 1 min read

Hàm bảo trì website mà không cần dùng plugins [php] function wp_maintenance_mode(){ if(!current_user_can(‘edit_themes’) || !is_user_logged_in()){ wp_die(‘ Vui lòng kích hoạt bản quyền code trang web này Liên hệ…

Phân trang trong page

29 Tháng 10, 2018 1 min read

Code phân trang trong page với các bài viết con của page đó. [php] $pages = get_pages(“child_of=”.get_the_ID()); if ($pages) { foreach ($pages as $page) { $ids[] = $page->ID;…

Tìm kiếm theo danh mục trong wordpress

26 Tháng 10, 2018 1 min read

Trong wp để tìm kiếm theo danh mục tùy chọn đường dẫn URL tìm kiếm của wp có dạng như [code] https://localhost.com/?product_cat=demo&post_type=product&s=tukhoa [/code]   trong đó localhost.com :…

1 số Plugins cho website

25 Tháng 10, 2018 1 min read

Firelight Lightbox XT Floating Cart for WooCommerce Side Cart Woocommerce | Woocommerce Cart      

Thêm sản phẩm vào giỏ hàng

24 Tháng 10, 2018 1 min read

Thêm sản phẩm vào giỏ hàng. $ID là id của sản phẩm. $number là số lượng sản phẩm [php]WC()->cart->add_to_cart($ID,$number)[/php]

lấy ảnh đại diện từ video youtube

23 Tháng 10, 2018 1 min read

Giả sử video a e muốn lấy ảnh đại diện là [code]https://www.youtube.com/watch?v=uYaDNle4X0A[/code] Thay ID video vào url bên dưới URL Ảnh đại diện cần lấy sẽ là (max…