Category

Akasa Code WP

36 articles in this category

Shortcodes Woocommerce

2 Tháng 11, 2018 3 min read

1.Form Giỏ hàng [php] [woocommerce_cart] [/php] 2. Form thanh toán [php] [woocommerce_checkout] [/php] Form tài khoản [php] [woocommerce_my_account] [/php] form track order [php] [woocommerce_order_tracking] [/php] Sản phẩm nổi…

Hướng dẫn Tự tạo widget

1 Tháng 11, 2018 1 min read

Đây là ví dụ tạo widget hiển thị bài viết ngẫu nhiên [php] class Random_Post extends WP_Widget { function __construct() { parent::__construct( ‘random_post’, ‘Bài ngẫu nhiên’, array( ‘description’…

Tích hợp Acf vào theme

31 Tháng 10, 2018 1 min read

[php] add_filter(‘acf/settings/path’, ‘my_acf_settings_path’); function my_acf_settings_path( $path ) { // update path $path = get_stylesheet_directory() . ‘/acf/’; return $path; } // 2. customize ACF dir add_filter(‘acf/settings/dir’, ‘my_acf_settings_dir’); function my_acf_settings_dir(…

Bộ lọc the_excerpt

31 Tháng 10, 2018 1 min read

[php] //Giới hạn 100 số từ cắt từ hàm the_excerpt : add_filter(‘excerpt_length’,function($number){ return 100; }); // thay đổi kí tự hiển thị xem tiếp trong hàm the_excerpt add_filter(‘excerpt_more’,function($more){…

1 số Hàm trong woocommerce

29 Tháng 10, 2018 1 min read

[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 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ệ…