Những đoạn code tùy biến website

1/ Hook thêm code vào sản phẩm

add_action('woocommerce_after_shop_loop_item_title','add_cart_icon');
function add_cart_icon(){
    global $product;

// The output is still filterable through the same filter
// $args and $attributes are made available to the filter
echo apply_filters(
		'woocommerce_loop_add_to_cart_link',
		sprintf( '<a rel="nofollow" href="%s" %s>
		<img src="http://duan4.cvbanks.net/wp-content/uploads/2020/06/Group-59.png">
		&gt;</a>',
			esc_url( $product->add_to_cart_url() ),
			implode( ' ', $attributes )),
		$product, $args, $attributes
);
}
add_action( 'flatsome_product_box_after','fv_feature_slider' );
function fv_feature_slider(){
	global $product;
        echo '<div class="fv-btn-readmore">
				<a href="'.get_permalink($product_id).'" class="button is-outline primary is-small">Xem Thêm</a>
			  </div>';
}

2/ Thêm Breadcrum yoast seo vào các trang ngoại trừ trang chủ qua file function.php

add_action('flatsome_after_header','fv_add_breadcrumb');
function fv_add_breadcrumb(){
	if ( !is_front_page() && !is_home() && function_exists('yoast_breadcrumb')  ) {
	  echo '<div class="fv-header-breadcrums dark"><div class="row row-collapse"><div class="col large-12">';
	  yoast_breadcrumb( '<p id="breadcrumbs">','</p>' );
	  echo '</div></div></div>';
	}
}

3/ Thêm nút gọi vào sau button add to cart ở single-product.php qua file function.php

add_action('woocommerce_after_add_to_cart_button','fv_contact');
function fv_contact(){
	echo '<a href="tel:0904.690.609" target="_self" class="button alert" style="border-radius:4px;"> <i class="icon-phone"></i> <span>Liên hệ</span> </a>';
}

4/ Rút gọn tiêu đề hoặc mô tả bài viết sản phẩm (Only CSS)

// Rút gọn 1 dòng và thêm ...
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
//Rút gọn tiêu đề từ 2 dòng và thêm “…”
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2; //thay số dòng muốn thay đổi
-webkit-box-orient: vertical;