Code PHP Lấy ID youtube video
function get_youtube_id( $url ){ parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars ); if( isset($my_array_of_vars['v']) ){ return $my_array_of_vars['v']; } return ''; } function get_youtube_video_embeg( $url ){ $id = get_youtube_id($url); if( $id != '' ) return '<iframe class="youtube" width="100%" height="450" src="https://www.youtube.com/embed/'.$id.'" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>'; }
Code youtube video size 16:9
<div class="youtube-wrap"> <iframe class="youtube" width="100%" height="100%" src="https://www.youtube.com/embed/N8Nr0vPMA7I" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen=""></iframe> </div> // CSS <style> .youtube-wrap{ position: relative; padding-top: 56.25%; } .youtube-wrap iframe{ position: absolute; top:0; left:0; right:0; bottom:0; } </style>
Thêm text domain translation cho child theme
function flatsome_child_setup() { $path = get_stylesheet_directory().'/languages'; load_child_theme_textdomain( 'flatsome-child', $path ); } add_action( 'after_setup_theme', 'flatsome_child_setup' );
Change add to cart text
add_filter( 'woocommerce_product_add_to_cart_text', 'product_cat_add_to_cart_button_text', 20, 1 ); function product_cat_add_to_cart_button_text( $text ) { $text = __( 'Add To Bag', 'flatsome-child' ); return $text; }
Thay đổi tiêu đề Shipping sử dụng translation trong trang thanh toán woocommerce
add_filter( 'woocommerce_cart_shipping_method_full_label', 'change_cart_shipping_method_full_label', 10, 2 ); function change_cart_shipping_method_full_label( $label, $method ) { if( $method->method_id == 'local_pickup' ){ $label = __('Pick up at store','flatsome-child').': '. number_format($method->cost). get_woocommerce_currency_symbol() ; } if( $method->method_id == 'jem_table_rate' ){ $label = __('Shipping fee','flatsome-child').': '. number_format($method->cost). get_woocommerce_currency_symbol() ; } return $label; }