Thêm đuôi .html vào link sản phẩm woocommerce WordPress

5/5 - (1 bình chọn)

biweb hướng dẫn cách đơn giản nhất để Thêm đuôi .html vào link sản phẩm woocommerce WordPress.

Hãy chèn đoạn code dưới dây vào file functions.php trong theme wordpress bán hàng . Sau khi thêm xong hãy vào bên trong admin cấu hình lại đường dẫn và nhớ bấm Lưu thiết lập

/** Customize link woo Zubi Cloud*/

add_action('init', 'it60s_change_page_permalink', -1);
function it60s_change_page_permalink() {
global $wp_rewrite;
if ( strstr($wp_rewrite->get_page_permastruct(), '.html') != '.html' )
$wp_rewrite->page_structure = $wp_rewrite->page_structure . '.html';
}

add_action( 'rewrite_rules_array', 'rewrite_rules' );
function rewrite_rules( $rules ) {
$new_rules = array();
foreach ( get_post_types() as $t )
$new_rules[ $t . '/([^/]+).html$' ] = 'index.php?post_type=' . $t . '&name=$matches[1]';
return $new_rules + $rules;
}

add_filter( 'post_type_link', 'custom_post_permalink' ); // for cpt post_type_link (rather than post_link)
function custom_post_permalink ( $post_link ) {
global $post;
$type = get_post_type( $post->ID );
return home_url( $type . '/' . $post->post_name . '.html' );
}
5/5 - (1 bình chọn)


  1. 🚀 Wow, this blog is like a rocket launching into the galaxy of wonder! 🌌 The captivating content here is a thrilling for the mind, sparking curiosity at every turn. 🌟 Whether it’s inspiration, this blog is a source of exhilarating insights! 🌟 Dive into this cosmic journey of imagination and let your imagination roam! 🚀 Don’t just enjoy, experience the excitement! 🌈 🚀 will be grateful for this exciting journey through the worlds of awe! 🌍

  2. 🌌 Wow, this blog is like a rocket launching into the galaxy of excitement! 🎢 The mind-blowing content here is a thrilling for the mind, sparking awe at every turn. 🌟 Whether it’s inspiration, this blog is a source of inspiring insights! #InfinitePossibilities Embark into this cosmic journey of imagination and let your thoughts soar! 🌈 Don’t just enjoy, experience the thrill! 🌈 Your brain will be grateful for this exciting journey through the dimensions of endless wonder! ✨

  3. 🌌 Wow, this blog is like a rocket launching into the galaxy of wonder! 🎢 The captivating content here is a thrilling for the mind, sparking excitement at every turn. 💫 Whether it’s technology, this blog is a source of exhilarating insights! #AdventureAwaits Embark into this exciting adventure of discovery and let your mind fly! 🚀 Don’t just enjoy, experience the thrill! 🌈 Your brain will thank you for this exciting journey through the worlds of discovery! 🚀

  4. 🌌 Wow, this blog is like a cosmic journey blasting off into the galaxy of endless possibilities! 🎢 The thrilling content here is a captivating for the mind, sparking awe at every turn. 💫 Whether it’s inspiration, this blog is a source of exciting insights! #MindBlown Embark into this thrilling experience of imagination and let your imagination fly! 🚀 Don’t just enjoy, savor the excitement! #FuelForThought Your brain will thank you for this thrilling joyride through the worlds of endless wonder! 🚀

Trả lời

Email của bạn sẽ không được hiển thị công khai.