<?php
// Remove page title if first block is the acf-hero-block
function wd_remove_entry_title() {
global $post;
// check if the post is using the block editor
if ( has_blocks( $post->post_content ) ) {
$blocks = parse_blocks( $post->post_content );
// check if the first block is the 'acf-hero-block'
if ( $blocks[0]['blockName'] === 'acf/acf-hero-block' ) {
// remove the page title if first block is the acf-hero-block
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
}
}
}
add_action( 'genesis_before_entry', 'wd_remove_entry_title' );