GeneratePress: Ẩn ảnh đại diện trong trang bài viết

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

Tạm dịch khi từ khoá tiếng Anh: GeneratePress – Hide featured image on single post template.

Để sử dụng, bạn thêm vào file functions.php trong giao diện đang kích hoạt.

add_action('wp', 'jobwp_single_post_remove_featured_image', 110);
/**
 * Completely remove featured image on single post
 *
 * @package jobwp.net
 * @author codetot
 * @ref http://jobwp.net/
 */
function jobwp_single_post_remove_featured_image() {
	if ( !is_singular('post') ) return;

	remove_action( 'generate_after_entry_header', 'generate_blog_single_featured_image' );
	remove_action( 'generate_before_content', 'generate_blog_single_featured_image' );
	remove_action( 'generate_after_header', 'generate_blog_single_featured_image' );
	remove_action( 'generate_before_content', 'generate_featured_page_header_inside_single' );
	remove_action( 'generate_after_header', 'generate_featured_page_header' );
}

You may also like