Author

admin

1 số Hàm trong woocommerce

29 Tháng 10, 2018

[php] //Shop URL $shop_page_url = get_permalink( woocommerce_get_page_id( ‘shop’ ) ) //My Account URL $myaccount_page_id = get_option( ‘woocommerce_myaccount_page_id’ ); if ( $myaccount_page_id ) { $myaccount_page_url = get_permalink( $myaccount_page_id );…

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

29 Tháng 10, 2018

[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

[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

[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

[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

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

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

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

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

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]