Cách thêm thông tin dự án bài viết trong flatsome

Để thêm thông tin chi tiết dự án trong web sử dụng theme flatsome bạn dùng code sau nhé:

/**
 * Chèn nội dung sau tiêu đề bài viết trong UX Blog (Flatsome)
 */
add_action( 'flatsome_blog_post_after', 'sw_add_content_after_blog_title', 10 );

function sw_add_content_after_blog_title() {
    global $post;
	if ( !has_category( [6,7], $post ) ) return;
    $khach_hang = get_field('khach_hang');
    $dia_diem   = get_field('dia_diem');
    $thoi_gian  = get_field('thoi_gian');
	
	?>
		<div class="acf-after-title">
			<div class="acf-row"><span class="acf-label">Khách hàng:</span> 
				<span class="acf-val"><?php echo esc_html($khach_hang); ?></span>
			</div><!--end acf-row-->
        
			<div class="acf-row">
				<span class="acf-label">Địa điểm:</span>
				<span class="acf-val"><?php echo esc_html($dia_diem); ?></span>
		   </div>
			<div class="acf-row">
				<span class="acf-label">Thời gian:</span> 
				<span class="acf-val"><?php echo esc_html($thoi_gian); ?></span>
			</div>
		 </div><!--end title-->
	<?php
   
}


Rate this post

Để lại một bình luận

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

four × 3 =

Nhắn tin qua Zalo

0932644183