
// Add custom Theme Functions here
/*
 * Author: Cu Min
 * */
// Remove product cat base
add_filter('term_link', 'devvn_no_term_parents', 1000, 3);
function devvn_no_term_parents($url, $term, $taxonomy) {
    if($taxonomy == 'product_cat'){
        $term_nicename = $term->slug;
        $url = trailingslashit(get_option( 'home' )) . user_trailingslashit( $term_nicename, 'category' );
    }
    return $url;
}
// Add our custom product cat rewrite rules
function devvn_no_product_cat_parents_rewrite_rules($flash = false) {
    $terms = get_terms( array(
        'taxonomy' => 'product_cat',
        'post_type' => 'product',
        'hide_empty' => false,
    ));
    if($terms && !is_wp_error($terms)){
        foreach ($terms as $term){
            $term_slug = $term->slug;
            add_rewrite_rule($term_slug.'/?$', 'index.php?product_cat='.$term_slug,'top');
            add_rewrite_rule($term_slug.'/page/([0-9]{1,})/?$', 'index.php?product_cat='.$term_slug.'&paged=$matches[1]','top');
            add_rewrite_rule($term_slug.'/(?:feed/)?(feed|rdf|rss|rss2|atom)/?$', 'index.php?product_cat='.$term_slug.'&feed=$matches[1]','top');
        }
    }
    if ($flash == true)
        flush_rewrite_rules(false);
}
add_action('init', 'devvn_no_product_cat_parents_rewrite_rules');
/*Sửa lỗi khi tạo mới taxomony bị 404*/
add_action( 'create_term', 'devvn_new_product_cat_edit_success', 10);
add_action( 'edit_terms', 'devvn_new_product_cat_edit_success', 10);
add_action( 'delete_term', 'devvn_new_product_cat_edit_success', 10);
function devvn_new_product_cat_edit_success( ) {
    devvn_no_product_cat_parents_rewrite_rules(true);
}
/*
* Dịch giỏ hàng/ Thanh Toán/ Hoàn Tất
*/
add_filter( 'gettext', function ( $strings ) {
$text = array(
'SHOPPING CART' => 'Giỏ Hàng',
'CHECKOUT DETAILS' => 'Thanh Toán',
'ORDER COMPLETE' => 'Hoàn Tất',
'SKU' => 'Mã sản phẩm',
'CATEGORY ARCHIVES' => 'Danh mục',
'Thêm vào giỏ hàng' => 'Thêm vào giỏ',
'Specification' => 'Thông số kỹ thuật',
'Reviews' => 'Đánh giá',
'Show All Categories' => 'Hiện tất cả danh mục',
'No product categories exist.' => 'Không có sản phẩm trong danh mục này!',
'Sorry, it seems that there are no available payment methods. Please contact us if you require assistance or wish to make alternate arrangements.' => 'Không có phương thức thanh toán phù hợp!',
'Shipping Details' => 'Chi tiết giao hàng',
'Nothing Found' => 'Không tìm thấy',
'WEIGHT' => 'Trọng lượng',
'DESCRIPTION' => 'Mô tả',
'ADD TO CART' => 'Thêm vào giỏ hàng',
'BRANDS' => 'Hãng',
'COLOR' => 'Màu sắc',
'Your order' => 'Đơn hàng của bạn'


);
$strings = str_ireplace( array_keys( $text ), $text, $strings );
return $strings;
}, 20 );
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//hoatdong.toana.com.vn/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<url>
		<loc>https://hoatdong.toana.com.vn/</loc>
		<lastmod>2024-05-15T03:38:39+00:00</lastmod>
	</url>
	<url>
		<loc>https://hoatdong.toana.com.vn/gioi-thieu/</loc>
		<lastmod>2024-03-05T08:40:25+00:00</lastmod>
		<image:image>
			<image:loc>https://hoatdong.toana.com.vn/wp-content/uploads/2024/01/gioi-thieu-toan-a.webp</image:loc>
		</image:image>
	</url>
</urlset>
<!-- XML Sitemap generated by Yoast SEO -->